Forums / Developer / Adding file in ezpublish

Adding file in ezpublish

Author Message

Michaël Todorovic

Friday 09 January 2009 7:29:14 am

Hello,
I'm new to ezPublish and I would like to allow my users to upload files with FTP (ezpublish webdav isn't as fast as ftp). When a user sends a file to ftp, I would like to publish it in the according folder (like in webdav). The file arrival detection is done with inotify calling a php script (via cli). Which part of ezcomponents/ezpublish should I use ?
I think I should use the part of ezdhtml which does upload but don't know where it is located.

Thank you,
Best regards,
Michaël

Björn Dieding@xrow.de

Friday 09 January 2009 8:49:13 am

just to throw your attention on this one. i do not knwo if it works. I have never used it.

http://projects.ez.no/ezftp

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Michaël Todorovic

Wednesday 21 January 2009 7:06:56 am

Ok, I have done it with part of ezftp. I tried ezftp extension but it consumes 100% CPU. I use vsftpd with a user chrooted in a special directory (i.e. /var/www/extranet/virtualFtp). In order to put files in the right node, I made a php script updateFtp.php (run by cron) which lists content structure menu and creates directories in /var/www/extranet/virtualFtp. A menu called "Marketing" will create a directory "marketing" in /var/www/extranet/virtualFtp.
Via ftp, a user will send a file in marketing (/var/www/extranet/virtualFtp/marketing). The file will automatically added in Marketing node. In a word, it works like ezpublish webdav. Now I will create a new trigger and workflow to call updateFtp.php when a new node is created in menu. It will avoid cron and its latency : I run the script once a day so if I change something, I have to wait next day or run the script by hand.

I empty FTP files to avoid space waste. If a FTP file is overwritten, the ezpublish file is overwritten too. If I delete a FTP file, ezpublish file is moved to trash. Every day, a script is run to delete permanently 7 days old files. FTP directories can't be deleted thanks to vsftpd configuration (RMD ftp command is forbidden).

This solution is much faster than ez's webdav and it works well for now.

eZ debug

Timing: Jan 30 2025 19:35:20
Script start
Timing: Jan 30 2025 19:35:20
Module start 'content'
Timing: Jan 30 2025 19:35:20
Module end 'content'
Timing: Jan 30 2025 19:35:20
Script end

Main resources:

Total runtime0.2313 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 587.9297370.2969
Module start 'content' 0.00820.0147 958.22661,001.5156
Module end 'content' 0.02290.2083 1,959.74223,890.1875
Script end 0.2312  5,849.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00522.2274200.0003
Check MTime0.00140.6039200.0001
Mysql Total
Database connection0.00090.391310.0009
Mysqli_queries0.133357.64531410.0009
Looping result0.00140.61611390.0000
Template Total0.207989.910.2079
Template load0.00100.415010.0010
Template processing0.206989.479510.2069
Override
Cache load0.00070.294010.0007
Sytem overhead
Fetch class attribute can translate value0.00220.941310.0022
XML
Image XML parsing0.00020.099910.0002
General
dbfile0.00522.2296200.0003
String conversion0.00000.003130.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