How to create an unique temporary file?

Author Message

Jerome Despatis

Friday 01 July 2011 5:59:24 am

Is there in eZ API a magic function to do that ?

for now I use tempnam('/tmp', ...)

=> I guess /tmp is not the appropriate place to put the file... Maybe eZSys::varDirectory() is *the* place to use?

=> a better function than tempnam ? maybe better to use eZClusterFileHandler?

Thanks for your help

Jérôme Vieilledent

Friday 01 July 2011 6:29:30 am

Hi Jerome

It's actually up to you and what you need. If your temporary file needs to be used by several servers, then you indeed must use eZClusterFileHandler API.

If not, I'd better chosse the eZSys::varDirectory() approach you mention :). Don't forget to delete your temp file once you don't need it anymore !

Jerome Despatis

Friday 01 July 2011 6:43:43 am

Ok I understand

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 29 2025 19:20:59
Script start
Timing: Jan 29 2025 19:20:59
Module start 'layout'
Timing: Jan 29 2025 19:20:59
Module start 'content'
Timing: Jan 29 2025 19:20:59
Module end 'content'
Timing: Jan 29 2025 19:20:59
Script end

Main resources:

Total runtime0.0165 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.2500151.2266
Module start 'layout' 0.00580.0021 739.476636.6719
Module start 'content' 0.00780.0073 776.148490.1563
Module end 'content' 0.01510.0013 866.304729.9766
Script end 0.0164  896.2813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002314.1800140.0002
Check MTime0.00105.9387140.0001
Mysql Total
Database connection0.00074.172010.0007
Mysqli_queries0.002515.300830.0008
Looping result0.00000.060810.0000
Template Total0.00106.010.0010
Template load0.00074.379110.0007
Template processing0.00031.640710.0003
Override
Cache load0.00053.171410.0005
General
dbfile0.003420.615580.0004
String conversion0.00000.049240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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