Файловый менеджер - Редактировать - /var/www/html/dao.zip
Ðазад
PK ! l2*�y y WikiAwareEntity.phpnu �Iw�� <?php namespace MediaWiki\DAO; use MediaWiki\Page\PageIdentity; use MediaWiki\Revision\RevisionRecord; use MediaWiki\User\UserIdentity; use Wikimedia\Assert\PreconditionException; /** * Marker interface for entities aware of the wiki they belong to. * * Instances of classes implementing this interface belong to a specific * wiki and may be used in a cross-wiki context. Services using these * classes have to ensure the entities they operate on belong to the * correct wiki by calling assertWiki(). * * Additionally, some getters of implementing classes can take an optional * $wikiId parameter to assert on for extra protection against incorrect * cross-wiki access. The parameter should be added if using the property in * the context of a wrong wiki will cause DB corruption. Usually the rule of * thumb is fields which are commonly used as foreign keys, like page_id, rev_id, * user_id, actor_id etc. However, the exact line is left to the best judgement * of the implementers. * * Examples: {@link RevisionRecord::getId()} or {@link PageIdentity::getId()} * * @see Block * @see PageIdentity * @see RevisionRecord * @see UserIdentity * * @since 1.36 */ interface WikiAwareEntity { /** * @var bool Wiki ID value to use with instances that are * defined relative to the local wiki. */ public const LOCAL = false; /** * Throws if $wikiId is different from the return value of getWikiId(). * * @param string|false $wikiId The wiki ID expected by the caller. * Use self::LOCAL for the local wiki. * * @throws PreconditionException If $wikiId is not the ID of the wiki this entity * belongs to. */ public function assertWiki( $wikiId ); /** * Get the ID of the wiki this page belongs to. * * @return string|false The wiki's logical name, * or self::LOCAL to indicate the local wiki. */ public function getWikiId(); } PK ! �3� � WikiAwareEntityTrait.phpnu �Iw�� <?php /** * 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\DAO; use MediaWiki\Page\PageIdentity; use MediaWiki\User\UserIdentity; use Wikimedia\Assert\Assert; use Wikimedia\Assert\PreconditionException; /** * Helper trait for {@link WikiAwareEntity implementations} * @package MediaWiki\DAO */ trait WikiAwareEntityTrait { /** * Get the ID of the wiki this entity belongs to. * * @since 1.36 * * @see RevisionRecord::getWikiId() * @see UserIdentity::getWikiId() * @see PageIdentity::getWikiId() * @see Block::getWikiId() * * @return string|false The wiki's logical name or WikiAwareEntity::LOCAL for the local wiki */ abstract public function getWikiId(); /** * Throws if $wikiId is not the same as this entity wiki. * * @param string|false $wikiId The wiki ID expected by the caller. * * @throws PreconditionException */ public function assertWiki( $wikiId ) { if ( $wikiId !== $this->getWikiId() ) { $expected = $this->wikiIdToString( $wikiId ); $actual = $this->wikiIdToString( $this->getWikiId() ); throw new PreconditionException( "Expected " . __CLASS__ . " to belong to $expected, but it belongs to $actual" ); } } /** * Emits a deprecation warning $since version if $wikiId is not the same as this wiki. * * @param string|false $wikiId * @param string $since */ protected function deprecateInvalidCrossWiki( $wikiId, string $since ) { if ( $wikiId !== $this->getWikiId() ) { $expected = $this->wikiIdToString( $wikiId ); $actual = $this->wikiIdToString( $this->getWikiId() ); wfDeprecatedMsg( 'Deprecated cross-wiki access to ' . __CLASS__ . '. ' . "Expected: {$expected}, Actual: {$actual}. " . "Pass expected \$wikiId.", $since ); } } /** * Asserts correct $wikiId parameter was passed. * * @param string|false $wikiId */ protected function assertWikiIdParam( $wikiId ) { Assert::parameterType( [ 'string', 'false' ], $wikiId, '$wikiId' ); } /** * Convert $wikiId to a string for logging. * * @param string|false $wikiId * @return string */ private function wikiIdToString( $wikiId ): string { return $wikiId === WikiAwareEntity::LOCAL ? 'the local wiki' : "'{$wikiId}'"; } } PK ! l2*�y y WikiAwareEntity.phpnu �Iw�� PK ! �3� � � WikiAwareEntityTrait.phpnu �Iw�� PK � �
| ver. 1.1 | |
.
| PHP 8.4.18 | Ð“ÐµÐ½ÐµÑ€Ð°Ñ†Ð¸Ñ Ñтраницы: 0 |
proxy
|
phpinfo
|
ÐаÑтройка