[go: nahoru, domu]

Skip to content

Commit

Permalink
SUS-4080 | VideoInfo::isPremium can go away + improve type hinting
Browse files Browse the repository at this point in the history
  • Loading branch information
macbre committed Feb 8, 2018
1 parent c96d0f3 commit 9ea21b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
15 changes: 4 additions & 11 deletions extensions/wikia/VideoHandlers/videoInfo/VideoInfo.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,6 @@ public function getDuration() {
return $this->duration;
}

/**
* Check if it is premium video
* @return boolean
* @deprecated
*/
public function isPremium() {
return false;
}

/**
* Check if it is hd file
* @return boolean
Expand Down Expand Up @@ -270,7 +261,7 @@ protected function removeFromDatabase() {
/**
* get video object from title
* @param string $videoTitle
* @return object $video
* @return self $video
*/
public static function newFromTitle( $videoTitle ) {
$app = F::App();
Expand Down Expand Up @@ -306,7 +297,7 @@ public static function newFromTitle( $videoTitle ) {
/**
* get video object from row
* @param object $row
* @return array video
* @return self video
*/
protected static function newFromRow( $row ) {
$data = array(
Expand Down Expand Up @@ -387,6 +378,8 @@ protected static function getMemcKey( $videoTitle ) {
* save to cache
*/
protected function saveToCache() {
$cache = [];

foreach ( self::$fields as $field ) {
$cache[$field] = $this->$field;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,21 +185,16 @@ public function isVideoRemoved( $title ) {
/**
* check if video exists
* @param Title|string $title
* @param Boolean $premiumOnly
* @return Boolean
*/
public function videoExists( $title, $premiumOnly = false ) {
public function videoExists( $title ) {
if ( is_string($title) ) {
$title = Title::newFromText( $title, NS_FILE );
}

if ( $title instanceof Title ) {
$videoInfo = VideoInfo::newFromTitle( $title->getDBKey() );
if ( !empty($videoInfo) ) {
if ( $premiumOnly ) {
return $videoInfo->isPremium();
}

return true;
}
}
Expand Down

0 comments on commit 9ea21b6

Please sign in to comment.