Forums / Extensions / SVN Post Commit Hook to import/update content objects - what's the best practice on where to create a /bin/php script

SVN Post Commit Hook to import/update content objects - what's the best practice on where to create a /bin/php script

Author Message

Conrad Decker

Thursday 07 October 2010 12:31:31 am

Hi All,

I'm creating a PHP script that will handle importing content objects into the content structure using the eZPublish api and a 'simple' PHP script, similar to what is done in this tutorial. I'm curious what the best practices are for where to place this file in the eZPublish directory structure. According to the tutorial, it looks like it should be placed in the /bin/php directory, my only concern would be is this going to be an issue if eZ is ever upgraded? Is it possible to put this script in an extension so that it could be easily moved around with the extension? I guess it could essentially be placed anywhere in the directory structure assuming it has access to the required autoload file?

The concept for the script is actually pretty straight forward, but I'm open to recommendations if anyone has any thoughts as to a better way to achieve this. The plan is to store a bunch of binary files on a network drive. Periodically, a scheduled process will run through the directory and add any unversioned files to SVN, delete any versioned files that no longer exist, and commit all changes to an SVN repository. On the repository side there will be a post-commit hook that will send an update to the script that I'm creating with information regarding which files have been added, modified, and deleted. This script would then grab the new/modified files and import/update them in eZ, and delete any files that have been removed from the repository.

The end goal is to essentially keep a local drive, and a publicly web accessible file repository in sync. Webdav was my original thought process which works great, but the biggest issue I've run into is that the folders/files that we're trying to sync have different naming conventions then the URL alias naming convention that Webdav uses for displaying folders/files to the webdav client so keeping the two directories in sync using an automated process has become a pain in the butt.

I'm absolutely open to any suggestions should anyone have something they think may be a better solution, but in the meantime I'm going to keep trucking away...hopefully it'll help someone else with a similar problem down the road.

Any/all help is certainly appreciated. Thanks!

eZ debug

Timing: Jan 29 2025 13:47:37
Script start
Timing: Jan 29 2025 13:47:37
Module start 'content'
Timing: Jan 29 2025 13:47:37
Module end 'content'
Timing: Jan 29 2025 13:47:37
Script end

Main resources:

Total runtime0.1395 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.6094180.7422
Module start 'content' 0.00540.0080 769.351694.1641
Module end 'content' 0.01340.1261 863.5156524.6563
Script end 0.1394  1,388.1719 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00352.5440200.0002
Check MTime0.00130.9644200.0001
Mysql Total
Database connection0.00080.545510.0008
Mysqli_queries0.089764.32191410.0006
Looping result0.00110.76681390.0000
Template Total0.125790.110.1257
Template load0.00080.600710.0008
Template processing0.124989.511810.1249
Override
Cache load0.00060.415110.0006
Sytem overhead
Fetch class attribute can translate value0.00100.711810.0010
XML
Image XML parsing0.00030.197910.0003
General
dbfile0.01017.2305200.0005
String conversion0.00000.004430.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs