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


PHP Filesystem::deleteFileIfExists方法代码示例

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


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

示例1: deleteIfLastModifiedBefore14August2014

 private static function deleteIfLastModifiedBefore14August2014($path)
 {
     $modifiedTime = filemtime($path);
     if ($modifiedTime && $modifiedTime < 1408000000) {
         Filesystem::deleteFileIfExists($path);
     }
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:7,代码来源:2.5.0-rc2.php

示例2: destroy

 public function destroy()
 {
     Filesystem::deleteFileIfExists($this->tmpFile);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:4,代码来源:Output.php

示例3: finishProcess

 public function finishProcess()
 {
     Filesystem::deleteFileIfExists($this->pidFile);
 }
开发者ID:diosmosis,项目名称:piwik,代码行数:4,代码来源:Process.php

示例4: download

 public function download()
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->dieIfPluginsAdminIsDisabled();
     $pluginName = new PluginName();
     $pluginName = $pluginName->getPluginName();
     Nonce::checkNonce($pluginName);
     $filename = $pluginName . '.zip';
     try {
         $pathToPlugin = $this->marketplaceApi->download($pluginName);
         ProxyHttp::serverStaticFile($pathToPlugin, 'application/zip', $expire = 0, $start = false, $end = false, $filename);
     } catch (Exception $e) {
         Common::sendResponseCode(500);
         Log::warning('Could not download file . ' . $e->getMessage());
     }
     if (!empty($pathToPlugin)) {
         Filesystem::deleteFileIfExists($pathToPlugin);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:19,代码来源:Controller.php

示例5: sendReport

 public function sendReport($idReport, $period = false, $date = false, $force = false)
 {
     Piwik::checkUserIsNotAnonymous();
     $reports = $this->getReports($idSite = false, false, $idReport);
     $report = reset($reports);
     if ($report['period'] == 'never') {
         $report['period'] = 'day';
     }
     if (!empty($period)) {
         $report['period'] = $period;
     }
     if (empty($date)) {
         $date = Date::now()->subPeriod(1, $report['period'])->toString();
     }
     $language = \Piwik\Plugins\LanguagesManager\API::getInstance()->getLanguageForUser($report['login']);
     // generate report
     list($outputFilename, $prettyDate, $reportSubject, $reportTitle, $additionalFiles) = $this->generateReport($idReport, $date, $language, self::OUTPUT_SAVE_ON_DISK, $report['period']);
     if (!file_exists($outputFilename)) {
         throw new Exception("The report file wasn't found in {$outputFilename}");
     }
     $contents = file_get_contents($outputFilename);
     if (empty($contents)) {
         Log::warning("Scheduled report file '%s' exists but is empty!", $outputFilename);
     }
     /**
      * Triggered when sending scheduled reports.
      *
      * Plugins that provide new scheduled report transport mediums should use this event to
      * send the scheduled report.
      *
      * @param string $reportType A string ID describing how the report is sent, eg,
      *                           `'sms'` or `'email'`.
      * @param array $report An array describing the scheduled report that is being
      *                      generated.
      * @param string $contents The contents of the scheduled report that was generated
      *                         and now should be sent.
      * @param string $filename The path to the file where the scheduled report has
      *                         been saved.
      * @param string $prettyDate A prettified date string for the data within the
      *                           scheduled report.
      * @param string $reportSubject A string describing what's in the scheduled
      *                              report.
      * @param string $reportTitle The scheduled report's given title (given by a Piwik user).
      * @param array $additionalFiles The list of additional files that should be
      *                               sent with this report.
      * @param \Piwik\Period $period The period for which the report has been generated.
      * @param boolean $force A report can only be sent once per period. Setting this to true
      *                       will force to send the report even if it has already been sent.
      */
     Piwik::postEvent(self::SEND_REPORT_EVENT, array($report['type'], $report, $contents, $filename = basename($outputFilename), $prettyDate, $reportSubject, $reportTitle, $additionalFiles, \Piwik\Period\Factory::build($report['period'], $date), $force));
     // Update flag in DB
     $now = Date::now()->getDatetime();
     $this->getModel()->updateReport($report['idreport'], array('ts_last_sent' => $now));
     if (!Development::isEnabled()) {
         @chmod($outputFilename, 0600);
         Filesystem::deleteFileIfExists($outputFilename);
     }
 }
开发者ID:piwik,项目名称:piwik,代码行数:58,代码来源:API.php

示例6: download

 public function download($pluginOrThemeName)
 {
     @ignore_user_abort(true);
     SettingsServer::setMaxExecutionTime(0);
     $downloadUrl = $this->getDownloadUrl($pluginOrThemeName);
     if (empty($downloadUrl)) {
         return false;
     }
     // in the beginning we allowed to specify a download path but this way we make sure security is always taken
     // care of and we always generate a random download filename.
     $target = $this->getRandomTmpPluginDownloadFilename();
     Filesystem::deleteFileIfExists($target);
     $success = $this->service->download($downloadUrl, $target, static::HTTP_REQUEST_TIMEOUT);
     if ($success) {
         return $target;
     }
     return false;
 }
开发者ID:piwik,项目名称:piwik,代码行数:18,代码来源:Client.php

示例7: removeFileIfExists

 /**
  * @param $targetTmpFile
  */
 private function removeFileIfExists($targetTmpFile)
 {
     Filesystem::deleteFileIfExists($targetTmpFile);
 }
开发者ID:piwik,项目名称:piwik,代码行数:7,代码来源:PluginInstaller.php


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