Файловый менеджер - Редактировать - /var/www/html/revisionlist.zip
Ðазад
PK ! f��#� � RevisionListBase.phpnu �Iw�� <?php /** * Holders of revision list for a single page * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * * @file */ namespace MediaWiki\RevisionList; use Iterator; use MediaWiki\Context\ContextSource; use MediaWiki\Context\IContextSource; use MediaWiki\Debug\DeprecationHelper; use MediaWiki\MediaWikiServices; use MediaWiki\Page\PageIdentity; use MediaWiki\Title\Title; use stdClass; use Wikimedia\Rdbms\IReadableDatabase; use Wikimedia\Rdbms\IResultWrapper; /** * List for revision table items for a single page */ abstract class RevisionListBase extends ContextSource implements Iterator { use DeprecationHelper; /** @var PageIdentity */ protected $page; /** @var int[]|null */ protected $ids; /** @var IResultWrapper|false */ protected $res; /** @var RevisionItemBase|false */ protected $current; /** * Construct a revision list for a given page identity * @param IContextSource $context * @param PageIdentity $page */ public function __construct( IContextSource $context, PageIdentity $page ) { $this->setContext( $context ); $this->page = $page; $this->deprecatePublicPropertyFallback( 'title', '1.37', function (): Title { return Title::newFromPageIdentity( $this->page ); }, function ( PageIdentity $page ) { $this->page = $page; } ); } /** * @return PageIdentity */ public function getPage(): PageIdentity { return $this->page; } /** * @internal for use by RevDelItems * @return string */ public function getPageName(): string { return Title::newFromPageIdentity( $this->page )->getPrefixedText(); } /** * Select items only where the ID is any of the specified values * @param int[] $ids */ public function filterByIds( array $ids ) { $this->ids = $ids; } /** * Get the internal type name of this list. Equal to the table name. * Override this function. * @return string|null */ public function getType() { return null; } /** * Initialise the current iteration pointer */ protected function initCurrent() { $row = $this->res->current(); if ( $row ) { $this->current = $this->newItem( $row ); } else { $this->current = false; } } /** * Start iteration. This must be called before current() or next(). * @return RevisionItemBase First list item */ public function reset() { if ( !$this->res ) { $this->res = $this->doQuery( MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase() ); } else { $this->res->rewind(); } $this->initCurrent(); return $this->current; } public function rewind(): void { $this->reset(); } /** * Get the current list item, or false if we are at the end * @return RevisionItemBase|false */ #[\ReturnTypeWillChange] public function current() { return $this->current; } /** * Move the iteration pointer to the next list item, and return it. * @return RevisionItemBase * @suppress PhanParamSignatureMismatchInternal */ #[\ReturnTypeWillChange] public function next() { $this->res->next(); $this->initCurrent(); return $this->current; } public function key(): int { return $this->res ? $this->res->key() : 0; } public function valid(): bool { return $this->res && $this->res->valid(); } /** * Get the number of items in the list. * @return int */ public function length() { if ( !$this->res ) { return 0; } else { return $this->res->numRows(); } } /** * Do the DB query to iterate through the objects. * @param IReadableDatabase $db DB object to use for the query * @return IResultWrapper */ abstract public function doQuery( $db ); /** * Create an item object from a DB result row * @param stdClass $row * @return RevisionItemBase */ abstract public function newItem( $row ); } /** @deprecated class alias since 1.43 */ class_alias( RevisionListBase::class, 'RevisionListBase' ); PK ! `��# RevisionItem.phpnu �Iw�� <?php /** * Holders of revision list for a single page * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * * @file */ namespace MediaWiki\RevisionList; use MediaWiki\Context\RequestContext; use MediaWiki\Linker\Linker; use MediaWiki\MediaWikiServices; use MediaWiki\Revision\RevisionRecord; /** * Item class for a live revision table row */ class RevisionItem extends RevisionItemBase { /** @var RevisionRecord */ protected $revisionRecord; /** @var RequestContext */ protected $context; /** @inheritDoc */ public function __construct( RevisionListBase $list, $row ) { parent::__construct( $list, $row ); $this->revisionRecord = MediaWikiServices::getInstance() ->getRevisionFactory() ->newRevisionFromRow( $row ); $this->context = $list->getContext(); } /** * Get the RevisionRecord for the item * * @return RevisionRecord */ protected function getRevisionRecord(): RevisionRecord { return $this->revisionRecord; } /** @inheritDoc */ public function getIdField() { return 'rev_id'; } /** @inheritDoc */ public function getTimestampField() { return 'rev_timestamp'; } /** @inheritDoc */ public function getAuthorIdField() { return 'rev_user'; } /** @inheritDoc */ public function getAuthorNameField() { return 'rev_user_text'; } /** @inheritDoc */ public function canView() { return $this->getRevisionRecord()->userCan( RevisionRecord::DELETED_RESTRICTED, $this->context->getAuthority() ); } /** @inheritDoc */ public function canViewContent() { return $this->getRevisionRecord()->userCan( RevisionRecord::DELETED_TEXT, $this->context->getAuthority() ); } /** * @return bool */ public function isDeleted() { return $this->getRevisionRecord()->isDeleted( RevisionRecord::DELETED_TEXT ); } /** * Get the HTML link to the revision text. * @todo Essentially a copy of RevDelRevisionItem::getRevisionLink. That class * should inherit from this one, and implement an appropriate interface instead * of extending RevDelItem * @return string HTML */ protected function getRevisionLink() { $revRecord = $this->getRevisionRecord(); $date = $this->list->getLanguage()->userTimeAndDate( $revRecord->getTimestamp(), $this->list->getUser() ); if ( $this->isDeleted() && !$this->canViewContent() ) { return htmlspecialchars( $date ); } $linkRenderer = $this->getLinkRenderer(); return $linkRenderer->makeKnownLink( $this->list->getPage(), $date, [], [ 'oldid' => $revRecord->getId(), 'unhide' => 1 ] ); } /** * Get the HTML link to the diff. * @todo Essentially a copy of RevDelRevisionItem::getDiffLink. That class * should inherit from this one, and implement an appropriate interface instead * of extending RevDelItem * @return string HTML */ protected function getDiffLink() { if ( $this->isDeleted() && !$this->canViewContent() ) { return $this->context->msg( 'diff' )->escaped(); } else { $linkRenderer = $this->getLinkRenderer(); return $linkRenderer->makeKnownLink( $this->list->getPage(), $this->list->msg( 'diff' )->text(), [], [ 'diff' => $this->getRevisionRecord()->getId(), 'oldid' => 'prev', 'unhide' => 1 ] ); } } /** * @todo Essentially a copy of RevDelRevisionItem::getHTML. That class * should inherit from this one, and implement an appropriate interface instead * of extending RevDelItem * @return string HTML */ public function getHTML() { $difflink = $this->context->msg( 'parentheses' ) ->rawParams( $this->getDiffLink() )->escaped(); $revlink = $this->getRevisionLink(); $userlink = Linker::revUserLink( $this->getRevisionRecord() ); $comment = MediaWikiServices::getInstance()->getCommentFormatter() ->formatRevision( $this->getRevisionRecord(), $this->context->getAuthority() ); if ( $this->isDeleted() ) { $class = Linker::getRevisionDeletedClass( $this->getRevisionRecord() ); $revlink = "<span class=\"$class\">$revlink</span>"; } return "<li>$difflink $revlink $userlink $comment</li>"; } } /** @deprecated class alias since 1.43 */ class_alias( RevisionItem::class, 'RevisionItem' ); PK ! �m��� � RevisionItemBase.phpnu �Iw�� <?php /** * Holders of revision list for a single page * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * * @file */ namespace MediaWiki\RevisionList; use MediaWiki\Linker\LinkRenderer; use MediaWiki\MediaWikiServices; use stdClass; /** * Abstract base class for revision items */ abstract class RevisionItemBase { /** @var RevisionListBase The parent */ protected $list; /** @var stdClass The database result row */ protected $row; /** * @param RevisionListBase $list * @param stdClass $row DB result row */ public function __construct( RevisionListBase $list, $row ) { $this->list = $list; $this->row = $row; } /** * Get the DB field name associated with the ID list. * Override this function. * @return string|null */ public function getIdField() { return null; } /** * Get the DB field name storing timestamps. * Override this function. * @return string|false */ public function getTimestampField() { return false; } /** * Get the DB field name storing user ids. * Override this function. * @return string|false */ public function getAuthorIdField() { return false; } /** * Get the DB field name storing user names. * Override this function. * @return string|false */ public function getAuthorNameField() { return false; } /** * Get the DB field name storing actor ids. * Override this function. * @since 1.31 * @return string|false */ public function getAuthorActorField() { return false; } /** * Get the ID, as it would appear in the ids URL parameter * @return int|string */ public function getId() { $field = $this->getIdField(); return intval( $this->row->$field ); } /** * Get the date, formatted in user's language * @return string */ public function formatDate() { return $this->list->getLanguage()->userDate( $this->getTimestamp(), $this->list->getUser() ); } /** * Get the time, formatted in user's language * @return string */ public function formatTime() { return $this->list->getLanguage()->userTime( $this->getTimestamp(), $this->list->getUser() ); } /** * Get the timestamp in MW 14-char form * @return string|false */ public function getTimestamp() { $field = $this->getTimestampField(); return wfTimestamp( TS_MW, $this->row->$field ); } /** * Get the author user ID * @return int */ public function getAuthorId() { $field = $this->getAuthorIdField(); return intval( $this->row->$field ); } /** * Get the author user name * @return string */ public function getAuthorName() { $field = $this->getAuthorNameField(); return strval( $this->row->$field ); } /** * Get the author actor ID * @since 1.31 * @return string */ public function getAuthorActor() { $field = $this->getAuthorActorField(); return strval( $this->row->$field ); } /** * Returns true if the current user can view the item * @return bool */ abstract public function canView(); /** * Returns true if the current user can view the item text/file * @return bool */ abstract public function canViewContent(); /** * Get the HTML of the list item. Should be include "<li></li>" tags. * This is used to show the list in HTML form, by the special page. * @return string HTML */ abstract public function getHTML(); /** * Returns an instance of LinkRenderer * @return LinkRenderer */ protected function getLinkRenderer() { return MediaWikiServices::getInstance()->getLinkRenderer(); } } /** @deprecated class alias since 1.43 */ class_alias( RevisionItemBase::class, 'RevisionItemBase' ); PK ! ÅN� � RevisionList.phpnu �Iw�� <?php /** * Holders of revision list for a single page * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * * @file */ namespace MediaWiki\RevisionList; use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\SelectQueryBuilder; class RevisionList extends RevisionListBase { /** @inheritDoc */ public function getType() { return 'revision'; } /** @inheritDoc */ public function doQuery( $db ) { $queryBuilder = MediaWikiServices::getInstance()->getRevisionStore()->newSelectQueryBuilder( $db ) ->joinComment() ->joinPage() ->joinUser() ->where( [ 'rev_page' => $this->page->getId() ] ) ->orderBy( 'rev_id', SelectQueryBuilder::SORT_DESC ); if ( $this->ids !== null ) { $queryBuilder->andWhere( [ 'rev_id' => array_map( 'intval', $this->ids ) ] ); } return $queryBuilder->caller( __METHOD__ )->fetchResultSet(); } /** @inheritDoc */ public function newItem( $row ) { return new RevisionItem( $this, $row ); } } /** @deprecated class alias since 1.43 */ class_alias( RevisionList::class, 'RevisionList' ); PK ! f��#� � RevisionListBase.phpnu �Iw�� PK ! `��# B RevisionItem.phpnu �Iw�� PK ! �m��� � �% RevisionItemBase.phpnu �Iw�� PK ! ÅN� � �6 RevisionList.phpnu �Iw�� PK H �=
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка