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


PHP LocalFile::newFromRow方法代码示例

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


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

示例1: newFileFromRow

 function newFileFromRow($row)
 {
     if (isset($row->img_name)) {
         return LocalFile::newFromRow($row, $this);
     } elseif (isset($row->oi_name)) {
         return OldLocalFile::newFromRow($row, $this);
     } else {
         throw new MWException(__METHOD__ . ': invalid row');
     }
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:10,代码来源:LocalRepo.php

示例2: purgeImagesSQL

 public function purgeImagesSQL($whereSQL)
 {
     # Purge files of any images
     # lance.gatlin@gmail.com: tested good 16Jul11
     $images_rows = $this->dbw->select('image', array('*'), array($whereSQL));
     if ($images_rows->numRows() == 0) {
         return;
     }
     $imageNames = array();
     foreach ($images_rows as $row) {
         $file = LocalFile::newFromRow($row, $this->repo);
         # Purge thumbnails and purge cache for pages using this image
         $file->purgeEverything();
         # Purge thumbnail directories
         // TODO: Mediawiki does not purge the directories used to store thumbnails
         $path = $file->getPath();
         if ($path !== false && file_exists($path)) {
             unlink($path);
         }
         $imageNames[] = "'" . $row->img_name . "'";
     }
     # Purge images
     # lance.gatlin@gmail.com: tested good 9Jul11
     $this->dbw->delete('image', array($whereSQL));
     # Purge old versions of these images
     $imageNames_list = implode(',', $imageNames);
     $this->purgeOldImagesSQL("oi_name IN ({$imageNames_list})");
     $this->purgePagesSQL("page_title IN ({$imageNames_list}) AND page_namespace={$this->nsFile}");
 }
开发者ID:seinlin,项目名称:UserAdmin,代码行数:29,代码来源:MWPurge_1_16.class.php

示例3: execute

 public function execute()
 {
     global $wgUser;
     $wgUser = User::newFromName(self::USER);
     $this->isDryRun = $this->hasOption('dry-run');
     $this->otherLocation = $this->getOption('other-location');
     $this->repo = RepoGroup::singleton()->getLocalRepo();
     $this->dbr = $this->getDB(DB_SLAVE);
     $images = 0;
     $imagesMissing = 0;
     $imagesFixed = 0;
     $res = $this->dbr->select('image', LocalFile::selectFields(), '', __METHOD__);
     $count = $res->numRows();
     $this->output(sprintf("Checking all images (%d images)%s...\n\n", $count, $this->isDryRun ? ' in dry run mode' : ''));
     while ($row = $res->fetchObject()) {
         $file = LocalFile::newFromRow($row, $this->repo);
         // 1. check file size (img_size = 0 in image table)
         $this->checkFileSize($file);
         // 2. check for missing files on FS / Swift storage
         $result = $this->processMissingFile($file);
         switch ($result) {
             case self::RESULT_RESTORED:
                 $imagesFixed++;
                 $imagesMissing++;
                 break;
             case self::RESULT_NOT_RESTORED:
                 $imagesMissing++;
                 break;
         }
         // progress
         if (++$images % 100) {
             $this->output(sprintf("%d%%\r", $images / $count * 100));
         }
     }
     // summary
     if (!empty($this->otherLocation)) {
         $this->output(sprintf("Restored %d images from second location \n", count($this->foundMissing)));
         $this->output("List of restored files: \n");
         $this->output(sprintf("%s\n\n", implode("\t\n", $this->foundMissing)));
     }
     $this->output(sprintf("Detected %d missing images (%.2f%% of %d images) and fixed %d images\n\n", $imagesMissing, $imagesMissing / $count * 100, $count, $imagesFixed));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:42,代码来源:fixBrokenImages.php


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