当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUtil::getTempFolder方法代码示例

本文整理汇总了PHP中wcf\util\FileUtil::getTempFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::getTempFolder方法的具体用法?PHP FileUtil::getTempFolder怎么用?PHP FileUtil::getTempFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wcf\util\FileUtil的用法示例。


在下文中一共展示了FileUtil::getTempFolder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

	/**
	 * Calls all init functions of the WCF and the WCFACP class. 
	 */
	public function __construct() {
		// add autoload directory
		self::$autoloadDirectories['wcf'] = WCF_DIR . 'lib/';
		
		// define tmp directory
		if (!defined('TMP_DIR')) define('TMP_DIR', FileUtil::getTempFolder());
		
		// start initialization
		$this->initMagicQuotes();
		$this->initDB();
		$this->loadOptions();
		$this->initPackage();
		$this->initSession();
		$this->initLanguage();
		$this->initTPL();
		$this->initCronjobs();
		$this->initCoreObjects();
		
		// prevent application loading during setup
		if (PACKAGE_ID) {
			$this->initApplications();
		}
		
		$this->initBlacklist();
		$this->initAuth();
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:29,代码来源:WCFACP.class.php

示例2: __construct

 /**
  * Calls all init functions of the WCF class.
  */
 public function __construct()
 {
     // add autoload directory
     self::$autoloadDirectories['wcf'] = WCF_DIR . 'lib/';
     // define tmp directory
     if (!defined('TMP_DIR')) {
         define('TMP_DIR', FileUtil::getTempFolder());
     }
     // register additional autoloaders
     require_once WCF_DIR . 'lib/system/api/phpline/phpline.phar';
     require_once WCF_DIR . 'lib/system/api/zend/Loader/StandardAutoloader.php';
     $zendLoader = new ZendLoader(array(ZendLoader::AUTOREGISTER_ZF => true));
     $zendLoader->register();
     $argv = new ArgvParser(array('packageID=i' => ''));
     $argv->setOption(ArgvParser::CONFIG_FREEFORM_FLAGS, true);
     $argv->parse();
     define('PACKAGE_ID', $argv->packageID ?: 1);
     // disable benchmark
     define('ENABLE_BENCHMARK', 0);
     // start initialization
     $this->initDB();
     $this->loadOptions();
     $this->initSession();
     $this->initLanguage();
     $this->initTPL();
     $this->initCoreObjects();
     $this->initApplications();
     // the destructor registered in core.functions.php will only call the destructor of the parent class
     register_shutdown_function(array('wcf\\system\\CLIWCF', 'destruct'));
     $this->initArgv();
     $this->initPHPLine();
     $this->initAuth();
     $this->checkForUpdates();
     $this->initCommands();
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:38,代码来源:CLIWCF.class.php

示例3: __construct

 /**
  * Calls all init functions of the WCF class.
  */
 public function __construct()
 {
     // add autoload directory
     self::$autoloadDirectories['wcf'] = WCF_DIR . 'lib/';
     // define tmp directory
     if (!defined('TMP_DIR')) {
         define('TMP_DIR', FileUtil::getTempFolder());
     }
     // start initialization
     $this->initMagicQuotes();
     $this->initDB();
     $this->loadOptions();
     $this->initSession();
     $this->initLanguage();
     $this->initTPL();
     $this->initCronjobs();
     $this->initCoreObjects();
     $this->initApplications();
     $this->initBlacklist();
     EventHandler::getInstance()->fireAction($this, 'initialized');
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:24,代码来源:WCF.class.php

示例4: tarFiles

 protected function tarFiles()
 {
     $files = new DirectoryUtil(CMS_DIR . 'files/');
     $tar = new TarWriter(FileUtil::getTempFolder() . 'files.tar');
     $fileList = $files->getFiles(SORT_ASC, new Regex('^' . CMS_DIR . 'files/$'), true);
     $tar->add($fileList, '', CMS_DIR . 'files/');
     $tar->create();
 }
开发者ID:knzo,项目名称:Fireball,代码行数:8,代码来源:BackupHandler.class.php

示例5: execute

 /**
  * @see	\wcf\system\cronjob\ICronjob::execute()
  */
 public function execute(Cronjob $cronjob)
 {
     parent::execute($cronjob);
     // clean up search keywords
     $sql = "SELECT\tAVG(searches) AS searches\n\t\t\tFROM\twcf" . WCF_N . "_search_keyword";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute();
     if (($row = $statement->fetchArray()) !== false) {
         $sql = "DELETE FROM\twcf" . WCF_N . "_search_keyword\n\t\t\t\tWHERE\t\tsearches <= ?\n\t\t\t\t\t\tAND lastSearchTime < ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array(floor($row['searches'] / 4), TIME_NOW - 86400 * 30));
     }
     // clean up notifications
     $sql = "DELETE FROM\twcf" . WCF_N . "_user_notification\n\t\t\tWHERE\t\ttime < ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(TIME_NOW - 86400 * USER_CLEANUP_NOTIFICATION_LIFETIME));
     // clean up user activity events
     $sql = "DELETE FROM\twcf" . WCF_N . "_user_activity_event\n\t\t\tWHERE\t\ttime < ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(TIME_NOW - 86400 * USER_CLEANUP_ACTIVITY_EVENT_LIFETIME));
     // clean up profile visitors
     $sql = "DELETE FROM\twcf" . WCF_N . "_user_profile_visitor\n\t\t\tWHERE\t\ttime < ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(TIME_NOW - 86400 * USER_CLEANUP_PROFILE_VISITOR_LIFETIME));
     // tracked visits
     $sql = "DELETE FROM\twcf" . WCF_N . "_tracked_visit\n\t\t\tWHERE\t\tobjectTypeID = ?\n\t\t\t\t\tAND visitTime < ?";
     $statement1 = WCF::getDB()->prepareStatement($sql);
     $sql = "DELETE FROM\twcf" . WCF_N . "_tracked_visit_type\n\t\t\tWHERE\t\tobjectTypeID = ?\n\t\t\t\t\tAND visitTime < ?";
     $statement2 = WCF::getDB()->prepareStatement($sql);
     WCF::getDB()->beginTransaction();
     foreach (ObjectTypeCache::getInstance()->getObjectTypes('com.woltlab.wcf.visitTracker.objectType') as $objectType) {
         // get lifetime
         $lifetime = $objectType->lifetime ?: VisitTracker::DEFAULT_LIFETIME;
         // delete data
         $statement1->execute(array($objectType->objectTypeID, $lifetime));
         $statement2->execute(array($objectType->objectTypeID, $lifetime));
     }
     WCF::getDB()->commitTransaction();
     // clean up cronjob log
     $sql = "DELETE FROM\twcf" . WCF_N . "_cronjob_log\n\t\t\tWHERE\t\texecTime < ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(TIME_NOW - 86400 * 7));
     // clean up session access log
     $sql = "DELETE FROM\twcf" . WCF_N . "_acp_session_access_log\n\t\t\tWHERE\t\tsessionLogID IN (\n\t\t\t\t\t\tSELECT\tsessionLogID\n\t\t\t\t\t\tFROM\twcf" . WCF_N . "_acp_session_log\n\t\t\t\t\t\tWHERE\tlastActivityTime < ?\n\t\t\t\t\t)";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(TIME_NOW - 86400 * 30));
     // clean up session log
     $sql = "DELETE FROM\twcf" . WCF_N . "_acp_session_log\n\t\t\tWHERE\t\tlastActivityTime < ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(TIME_NOW - 86400 * 30));
     // clean up search data
     $sql = "DELETE FROM\twcf" . WCF_N . "_search\n\t\t\tWHERE\t\tsearchTime < ?";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute(array(TIME_NOW - 86400));
     // clean up expired edit history entries
     if (MODULE_EDIT_HISTORY) {
         if (EDIT_HISTORY_EXPIRATION) {
             $sql = "DELETE FROM\twcf" . WCF_N . "_edit_history_entry\n\t\t\t\t\tWHERE\t\tobsoletedAt < ?";
             $statement = WCF::getDB()->prepareStatement($sql);
             $statement->execute(array(TIME_NOW - 86400 * EDIT_HISTORY_EXPIRATION));
         }
     } else {
         // edit history is disabled, prune old versions
         $sql = "DELETE FROM\twcf" . WCF_N . "_edit_history_entry";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute();
     }
     // clean up user authentication failure log
     if (ENABLE_USER_AUTHENTICATION_FAILURE) {
         $sql = "DELETE FROM\twcf" . WCF_N . "_user_authentication_failure\n\t\t\t\tWHERE\t\ttime < ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array(TIME_NOW - 86400 * USER_AUTHENTICATION_FAILURE_EXPIRATION));
     }
     // clean up error logs
     $files = @glob(WCF_DIR . 'log/*.txt');
     if (is_array($files)) {
         foreach ($files as $filename) {
             if (filectime($filename) < TIME_NOW - 86400 * 14) {
                 @unlink($filename);
             }
         }
     }
     // clean up temporary folder
     $tempFolder = FileUtil::getTempFolder();
     DirectoryUtil::getInstance($tempFolder)->executeCallback(new Callback(function ($filename, $object) use($tempFolder) {
         if ($filename === $tempFolder) {
             return;
         }
         if ($filename === $tempFolder . '.htaccess') {
             return;
         }
         if ($object->getMTime() < TIME_NOW - 86400) {
             if ($object->isDir()) {
                 @rmdir($filename);
             } else {
                 if ($object->isFile()) {
                     @unlink($filename);
//.........这里部分代码省略.........
开发者ID:nick-strohm,项目名称:WCF,代码行数:101,代码来源:DailyCleanUpCronjob.class.php


注:本文中的wcf\util\FileUtil::getTempFolder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。