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


PHP ArchivedFile::newFromRow方法代码示例

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


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

示例1: execute


//.........这里部分代码省略.........
             $sha1 = strtolower($params['sha1base36']);
             if (!$this->validateSha1Base36Hash($sha1)) {
                 $this->dieUsage('The SHA1Base36 hash provided is not valid', 'invalidsha1base36hash');
             }
         }
         if ($sha1) {
             $this->addWhereFld('fa_sha1', $sha1);
         }
     }
     // Exclude files this user can't view.
     if (!$user->isAllowed('deletedtext')) {
         $bitmask = File::DELETED_FILE;
     } elseif (!$user->isAllowedAny('suppressrevision', 'viewsuppressed')) {
         $bitmask = File::DELETED_FILE | File::DELETED_RESTRICTED;
     } else {
         $bitmask = 0;
     }
     if ($bitmask) {
         $this->addWhere($this->getDB()->bitAnd('fa_deleted', $bitmask) . " != {$bitmask}");
     }
     $limit = $params['limit'];
     $this->addOption('LIMIT', $limit + 1);
     $sort = $params['dir'] == 'descending' ? ' DESC' : '';
     $this->addOption('ORDER BY', array('fa_name' . $sort, 'fa_timestamp' . $sort, 'fa_id' . $sort));
     $res = $this->select(__METHOD__);
     $count = 0;
     $result = $this->getResult();
     foreach ($res as $row) {
         if (++$count > $limit) {
             // We've reached the one extra which shows that there are
             // additional pages to be had. Stop here...
             $this->setContinueEnumParameter('continue', "{$row->fa_name}|{$row->fa_timestamp}|{$row->fa_id}");
             break;
         }
         $file = array();
         $file['id'] = (int) $row->fa_id;
         $file['name'] = $row->fa_name;
         $title = Title::makeTitle(NS_FILE, $row->fa_name);
         self::addTitleInfo($file, $title);
         if ($fld_description && Revision::userCanBitfield($row->fa_deleted, File::DELETED_COMMENT, $user)) {
             $file['description'] = $row->fa_description;
             if (isset($prop['parseddescription'])) {
                 $file['parseddescription'] = Linker::formatComment($row->fa_description, $title);
             }
         }
         if ($fld_user && Revision::userCanBitfield($row->fa_deleted, File::DELETED_USER, $user)) {
             $file['userid'] = (int) $row->fa_user;
             $file['user'] = $row->fa_user_text;
         }
         if ($fld_sha1) {
             $file['sha1'] = wfBaseConvert($row->fa_sha1, 36, 16, 40);
         }
         if ($fld_timestamp) {
             $file['timestamp'] = wfTimestamp(TS_ISO_8601, $row->fa_timestamp);
         }
         if ($fld_size || $fld_dimensions) {
             $file['size'] = $row->fa_size;
             $pageCount = ArchivedFile::newFromRow($row)->pageCount();
             if ($pageCount !== false) {
                 $file['pagecount'] = $pageCount;
             }
             $file['height'] = $row->fa_height;
             $file['width'] = $row->fa_width;
         }
         if ($fld_mediatype) {
             $file['mediatype'] = $row->fa_media_type;
         }
         if ($fld_metadata) {
             $file['metadata'] = $row->fa_metadata ? ApiQueryImageInfo::processMetaData(unserialize($row->fa_metadata), $result) : null;
         }
         if ($fld_bitdepth) {
             $file['bitdepth'] = $row->fa_bits;
         }
         if ($fld_mime) {
             $file['mime'] = "{$row->fa_major_mime}/{$row->fa_minor_mime}";
         }
         if ($fld_archivename && !is_null($row->fa_archive_name)) {
             $file['archivename'] = $row->fa_archive_name;
         }
         if ($row->fa_deleted & File::DELETED_FILE) {
             $file['filehidden'] = true;
         }
         if ($row->fa_deleted & File::DELETED_COMMENT) {
             $file['commenthidden'] = true;
         }
         if ($row->fa_deleted & File::DELETED_USER) {
             $file['userhidden'] = true;
         }
         if ($row->fa_deleted & File::DELETED_RESTRICTED) {
             // This file is deleted for normal admins
             $file['suppressed'] = true;
         }
         $fit = $result->addValue(array('query', $this->getModuleName()), null, $file);
         if (!$fit) {
             $this->setContinueEnumParameter('continue', "{$row->fa_name}|{$row->fa_timestamp}|{$row->fa_id}");
             break;
         }
     }
     $result->addIndexedTagName(array('query', $this->getModuleName()), 'fa');
 }
开发者ID:D66Ha,项目名称:mediawiki,代码行数:101,代码来源:ApiQueryFilearchive.php

示例2: __construct

 public function __construct($list, $row)
 {
     RevDel_Item::__construct($list, $row);
     $this->file = ArchivedFile::newFromRow($row);
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:5,代码来源:RevisionDelete.php

示例3: execute


//.........这里部分代码省略.........
             if (!$this->validateSha1Hash($params['sha1'])) {
                 $this->dieUsage('The SHA1 hash provided is not valid', 'invalidsha1hash');
             }
             $sha1 = wfBaseConvert($params['sha1'], 16, 36, 31);
         } elseif ($sha1base36Set) {
             if (!$this->validateSha1Base36Hash($params['sha1base36'])) {
                 $this->dieUsage('The SHA1Base36 hash provided is not valid', 'invalidsha1base36hash');
             }
             $sha1 = $params['sha1base36'];
         }
         if ($sha1) {
             $this->addWhere('fa_storage_key ' . $db->buildLike("{$sha1}.", $db->anyString()));
         }
     }
     if (!$user->isAllowed('suppressrevision')) {
         // Filter out revisions that the user is not allowed to see. There
         // is no way to indicate that we have skipped stuff because the
         // continuation parameter is fa_name
         // Note that this field is unindexed. This should however not be
         // a big problem as files with fa_deleted are rare
         $this->addWhereFld('fa_deleted', 0);
     }
     $limit = $params['limit'];
     $this->addOption('LIMIT', $limit + 1);
     $sort = $params['dir'] == 'descending' ? ' DESC' : '';
     $this->addOption('ORDER BY', 'fa_name' . $sort);
     $res = $this->select(__METHOD__);
     $count = 0;
     $result = $this->getResult();
     foreach ($res as $row) {
         if (++$count > $limit) {
             // We've reached the one extra which shows that there are additional pages to be had. Stop here...
             $this->setContinueEnumParameter('continue', $row->fa_name);
             break;
         }
         $file = array();
         $file['name'] = $row->fa_name;
         $title = Title::makeTitle(NS_FILE, $row->fa_name);
         self::addTitleInfo($file, $title);
         if ($fld_sha1) {
             $file['sha1'] = wfBaseConvert(LocalRepo::getHashFromKey($row->fa_storage_key), 36, 16, 40);
         }
         if ($fld_timestamp) {
             $file['timestamp'] = wfTimestamp(TS_ISO_8601, $row->fa_timestamp);
         }
         if ($fld_user) {
             $file['userid'] = $row->fa_user;
             $file['user'] = $row->fa_user_text;
         }
         if ($fld_size || $fld_dimensions) {
             $file['size'] = $row->fa_size;
             $pageCount = ArchivedFile::newFromRow($row)->pageCount();
             if ($pageCount !== false) {
                 $vals['pagecount'] = $pageCount;
             }
             $file['height'] = $row->fa_height;
             $file['width'] = $row->fa_width;
         }
         if ($fld_description) {
             $file['description'] = $row->fa_description;
             if (isset($prop['parseddescription'])) {
                 $file['parseddescription'] = Linker::formatComment($row->fa_description, $title);
             }
         }
         if ($fld_mediatype) {
             $file['mediatype'] = $row->fa_media_type;
         }
         if ($fld_metadata) {
             $file['metadata'] = $row->fa_metadata ? ApiQueryImageInfo::processMetaData(unserialize($row->fa_metadata), $result) : null;
         }
         if ($fld_bitdepth) {
             $file['bitdepth'] = $row->fa_bits;
         }
         if ($fld_mime) {
             $file['mime'] = "{$row->fa_major_mime}/{$row->fa_minor_mime}";
         }
         if ($fld_archivename && !is_null($row->fa_archive_name)) {
             $file['archivename'] = $row->fa_archive_name;
         }
         if ($row->fa_deleted & File::DELETED_FILE) {
             $file['filehidden'] = '';
         }
         if ($row->fa_deleted & File::DELETED_COMMENT) {
             $file['commenthidden'] = '';
         }
         if ($row->fa_deleted & File::DELETED_USER) {
             $file['userhidden'] = '';
         }
         if ($row->fa_deleted & File::DELETED_RESTRICTED) {
             // This file is deleted for normal admins
             $file['suppressed'] = '';
         }
         $fit = $result->addValue(array('query', $this->getModuleName()), null, $file);
         if (!$fit) {
             $this->setContinueEnumParameter('continue', $row->fa_name);
             break;
         }
     }
     $result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'fa');
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:101,代码来源:ApiQueryFilearchive.php

示例4: formatFileRow

 private function formatFileRow($row)
 {
     $file = ArchivedFile::newFromRow($row);
     $ts = wfTimestamp(TS_MW, $row->fa_timestamp);
     $user = $this->getUser();
     $checkBox = '';
     if ($this->mCanView && $row->fa_storage_key) {
         if ($this->mAllowed) {
             $checkBox = Xml::check('fileid' . $row->fa_id);
         }
         $key = urlencode($row->fa_storage_key);
         $pageLink = $this->getFileLink($file, $this->getPageTitle(), $ts, $key);
     } else {
         $pageLink = $this->getLanguage()->userTimeAndDate($ts, $user);
     }
     $userLink = $this->getFileUser($file);
     $data = $this->msg('widthheight')->numParams($row->fa_width, $row->fa_height)->text();
     $bytes = $this->msg('parentheses')->rawParams($this->msg('nbytes')->numParams($row->fa_size)->text())->plain();
     $data = htmlspecialchars($data . ' ' . $bytes);
     $comment = $this->getFileComment($file);
     // Add show/hide deletion links if available
     $canHide = $this->isAllowed('deleterevision');
     if ($canHide || $file->getVisibility() && $this->isAllowed('deletedhistory')) {
         if (!$file->userCan(File::DELETED_RESTRICTED, $user)) {
             // Revision was hidden from sysops
             $revdlink = Linker::revDeleteLinkDisabled($canHide);
         } else {
             $query = array('type' => 'filearchive', 'target' => $this->mTargetObj->getPrefixedDBkey(), 'ids' => $row->fa_id);
             $revdlink = Linker::revDeleteLink($query, $file->isDeleted(File::DELETED_RESTRICTED), $canHide);
         }
     } else {
         $revdlink = '';
     }
     return "<li>{$checkBox} {$revdlink} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n";
 }
开发者ID:raymondzhangl,项目名称:mediawiki,代码行数:35,代码来源:SpecialUndelete.php

示例5: formatFileRow

 private function formatFileRow($row)
 {
     $file = ArchivedFile::newFromRow($row);
     $ts = wfTimestamp(TS_MW, $row->fa_timestamp);
     if ($this->mAllowed && $row->fa_storage_key) {
         $checkBox = Xml::check('fileid' . $row->fa_id);
         $key = urlencode($row->fa_storage_key);
         $pageLink = $this->getFileLink($file, $this->getTitle(), $ts, $key);
     } else {
         $checkBox = '';
         $pageLink = $this->getLang()->timeanddate($ts, true);
     }
     $userLink = $this->getFileUser($file);
     $data = wfMsg('widthheight', $this->getLang()->formatNum($row->fa_width), $this->getLang()->formatNum($row->fa_height)) . ' (' . wfMsg('nbytes', $this->getLang()->formatNum($row->fa_size)) . ')';
     $data = htmlspecialchars($data);
     $comment = $this->getFileComment($file);
     // Add show/hide deletion links if available
     $canHide = $this->getUser()->isAllowed('deleterevision');
     if ($canHide || $file->getVisibility() && $this->getUser()->isAllowed('deletedhistory')) {
         if (!$file->userCan(File::DELETED_RESTRICTED)) {
             $revdlink = Linker::revDeleteLinkDisabled($canHide);
             // revision was hidden from sysops
         } else {
             $query = array('type' => 'filearchive', 'target' => $this->mTargetObj->getPrefixedDBkey(), 'ids' => $row->fa_id);
             $revdlink = Linker::revDeleteLink($query, $file->isDeleted(File::DELETED_RESTRICTED), $canHide);
         }
     } else {
         $revdlink = '';
     }
     return "<li>{$checkBox} {$revdlink} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n";
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:31,代码来源:SpecialUndelete.php

示例6: setArchFileVisibility

 /**
  * @param $title, the page these events apply to
  * @param array $items list of revision ID numbers
  * @param int $bitfield new rev_deleted value
  * @param string $comment Comment for log records
  */
 function setArchFileVisibility($title, $items, $bitfield, $comment)
 {
     global $wgOut;
     $userAllowedAll = $success = true;
     $count = 0;
     $Id_set = array();
     // Run through and pull all our data in one query
     foreach ($items as $id) {
         $where[] = intval($id);
     }
     $result = $this->dbw->select('filearchive', '*', array('fa_name' => $title->getDBKey(), 'fa_id' => $where), __METHOD__);
     while ($row = $this->dbw->fetchObject($result)) {
         $filesObjs[$row->fa_id] = ArchivedFile::newFromRow($row);
     }
     // To work!
     foreach ($items as $fileid) {
         if (!isset($filesObjs[$fileid])) {
             $success = false;
             continue;
             // Must exist
         } else {
             if (!$filesObjs[$fileid]->userCan(File::DELETED_RESTRICTED)) {
                 $userAllowedAll = false;
                 continue;
             }
         }
         // Which revisions did we change anything about?
         if ($filesObjs[$fileid]->deleted != $bitfield) {
             $Id_set[] = $fileid;
             $count++;
             $this->updateArchFiles($filesObjs[$fileid], $bitfield);
         }
     }
     // Log if something was changed
     if ($count > 0) {
         $this->updateLog($title, $count, $bitfield, $comment, $filesObjs[$fileid]->deleted, $title, 'fileid', $Id_set);
     }
     // Where all revs allowed to be set?
     if (!$userAllowedAll) {
         $wgOut->permissionRequired('suppressrevision');
         return false;
     }
     return $success;
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:50,代码来源:SpecialRevisiondelete.php

示例7: purgeArchivedFilesSQL

 function purgeArchivedFilesSQL($whereSQL)
 {
     # Purge files of archived images
     # lance.gatlin@gmail.com: TESTME
     $archivedImages_rows = $this->dbw->select('filearchive', array('*'), array($whereSQL));
     if ($archivedImages_rows->numRows() == 0) {
         return;
     }
     foreach ($archivedImages_rows as $row) {
         # Images that have been deleted use ArchivedFile path => $IP/images/deleted
         $archivedFile = ArchivedFile::newFromRow($row);
         // No path helper in ArchivedFile class
         // Path code taken from DeleteArchiveFiles maintenance class
         $key = $archivedFile->getKey();
         $path = $this->repo->getZonePath('deleted') . '/' . $this->repo->getDeletedHashPath($key) . $key;
         if ($path !== false && file_exists($path)) {
             unlink($path);
         }
     }
     # Purge the archived images from database
     # lance.gatlin@gmail.com: TESTME
     $this->dbw->delete('filearchive', array($whereSQL));
 }
开发者ID:seinlin,项目名称:UserAdmin,代码行数:23,代码来源:MWPurge_1_16.class.php

示例8: scrubAllVersions

 protected function scrubAllVersions($name)
 {
     $dbw = $this->getDB(DB_MASTER);
     $res = $dbw->select('filearchive', '*', ['fa_name' => $name, 'fa_storage_group' => 'deleted'], __METHOD__);
     foreach ($res as $row) {
         $this->scrubVersion(ArchivedFile::newFromRow($row));
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:8,代码来源:eraseArchivedFile.php

示例9: __construct

 public function __construct($list, $row)
 {
     RevDelItem::__construct($list, $row);
     $this->file = ArchivedFile::newFromRow($row);
     $this->lockFile = RepoGroup::singleton()->getLocalRepo()->newFile($row->fa_name);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:6,代码来源:RevDelArchivedFileItem.php

示例10: formatFileRow

 private function formatFileRow($row, $sk)
 {
     global $wgUser, $wgLang;
     $file = ArchivedFile::newFromRow($row);
     $ts = wfTimestamp(TS_MW, $row->fa_timestamp);
     if ($this->mAllowed && $row->fa_storage_key) {
         $checkBox = Xml::check("fileid" . $row->fa_id);
         $key = urlencode($row->fa_storage_key);
         $target = urlencode($this->mTarget);
         $titleObj = SpecialPage::getTitleFor("Undelete");
         $pageLink = $this->getFileLink($file, $titleObj, $ts, $key, $sk);
     } else {
         $checkBox = '';
         $pageLink = $wgLang->timeanddate($ts, true);
     }
     $userLink = $this->getFileUser($file, $sk);
     $data = wfMsg('widthheight', $wgLang->formatNum($row->fa_width), $wgLang->formatNum($row->fa_height)) . ' (' . wfMsg('nbytes', $wgLang->formatNum($row->fa_size)) . ')';
     $data = htmlspecialchars($data);
     $comment = $this->getFileComment($file, $sk);
     $revdlink = '';
     if ($wgUser->isAllowed('deleterevision')) {
         $revdel = SpecialPage::getTitleFor('Revisiondelete');
         if (!$file->userCan(File::DELETED_RESTRICTED)) {
             // If revision was hidden from sysops
             $del = wfMsgHtml('rev-delundel');
         } else {
             $del = $sk->makeKnownLinkObj($revdel, wfMsgHtml('rev-delundel'), 'target=' . $this->mTargetObj->getPrefixedUrl() . '&fileid=' . $row->fa_id);
             // Bolden oversighted content
             if ($file->isDeleted(File::DELETED_RESTRICTED)) {
                 $del = "<strong>{$del}</strong>";
             }
         }
         $revdlink = "<tt>(<small>{$del}</small>)</tt>";
     }
     return "<li>{$checkBox} {$revdlink} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n";
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:36,代码来源:SpecialUndelete.php

示例11: formatFileRow

 private function formatFileRow($row, $sk)
 {
     global $wgUser, $wgLang;
     $file = ArchivedFile::newFromRow($row);
     $ts = wfTimestamp(TS_MW, $row->fa_timestamp);
     if ($this->mAllowed && $row->fa_storage_key) {
         $checkBox = Xml::check("fileid" . $row->fa_id);
         $key = urlencode($row->fa_storage_key);
         $target = urlencode($this->mTarget);
         $titleObj = SpecialPage::getTitleFor("Undelete");
         $pageLink = $this->getFileLink($file, $titleObj, $ts, $key, $sk);
     } else {
         $checkBox = '';
         $pageLink = $wgLang->timeanddate($ts, true);
     }
     $userLink = $this->getFileUser($file, $sk);
     $data = wfMsg('widthheight', $wgLang->formatNum($row->fa_width), $wgLang->formatNum($row->fa_height)) . ' (' . wfMsg('nbytes', $wgLang->formatNum($row->fa_size)) . ')';
     $data = htmlspecialchars($data);
     $comment = $this->getFileComment($file, $sk);
     $revdlink = '';
     if ($wgUser->isAllowed('deleterevision')) {
         if (!$file->userCan(File::DELETED_RESTRICTED)) {
             // If revision was hidden from sysops
             $revdlink = Xml::tags('span', array('class' => 'mw-revdelundel-link'), '(' . wfMsgHtml('rev-delundel') . ')');
         } else {
             $query = array('target' => $this->mTargetObj->getPrefixedDBkey(), 'fileid' => $row->fa_id);
             $revdlink = $sk->revDeleteLink($query, $file->isDeleted(File::DELETED_RESTRICTED));
         }
     }
     return "<li>{$checkBox} {$revdlink} {$pageLink} . . {$userLink} {$data} {$comment}</li>\n";
 }
开发者ID:josephdye,项目名称:wikireader,代码行数:31,代码来源:SpecialUndelete.php


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