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!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:18:58
Script start
Timing: Jan 18 2025 02:18:58
Module start 'layout'
Timing: Jan 18 2025 02:18:58
Module start 'content'
Timing: Jan 18 2025 02:18:58
Module end 'content'
Timing: Jan 18 2025 02:18:58
Script end

Main resources:

Total runtime0.4590 sec
Peak memory usage4,096.0000 KB
Database Queries47

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 588.6719152.7188
Module start 'layout' 0.00490.0024 741.390639.6250
Module start 'content' 0.00730.4501 781.0156445.0156
Module end 'content' 0.45740.0016 1,226.03137.9844
Script end 0.4590  1,234.0156 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00280.6140160.0002
Check MTime0.00120.2715160.0001
Mysql Total
Database connection0.00080.169010.0008
Mysqli_queries0.421591.8298470.0090
Looping result0.00030.0718450.0000
Template Total0.436595.120.2182
Template load0.00170.366620.0008
Template processing0.434894.714920.2174
Template load and register function0.00010.025110.0001
states
state_id_array0.00060.136610.0006
state_identifier_array0.00090.190120.0004
Override
Cache load0.00130.2927110.0001
Sytem overhead
Fetch class attribute can translate value0.00070.158610.0007
Fetch class attribute name0.00070.151920.0003
XML
Image XML parsing0.00070.144210.0007
class_abstraction
Instantiating content class attribute0.00000.001120.0000
General
dbfile0.00150.3271160.0001
String conversion0.00000.001540.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 7
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs