Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

CON-718 #3018

Merged
merged 3 commits into from Mar 5, 2014
Merged

CON-718 #3018

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 0 additions & 38 deletions extensions/wikia/AssetsManager/AssetsConfig.class.php
Expand Up @@ -10,38 +10,6 @@
class AssetsConfig {
private /* array */ $mConfig;

public static function getSiteCSS( $combine, $minify = null, $params = null, $skinname = 'oasis', $articleName = 'Wikia.css') {
wfProfileIn(__METHOD__);

$srcs = array();
global $wgSquidMaxage;
$siteargs = array(
'action' => 'raw',
'maxage' => $wgSquidMaxage,
);
// BugId:20929 tell (or trick) varnish to store the latest revisions of Wikia.css and Common.css.
$oTitleCommonCss = Title::newFromText( 'Common.css', NS_MEDIAWIKI );
$oTitleWikiaCss = Title::newFromText( 'Wikia.css', NS_MEDIAWIKI );
$siteargs['maxrev'] = max( (int) $oTitleWikiaCss->getLatestRevID(), (int) $oTitleCommonCss->getLatestRevID() );
unset( $oTitleWikiaCss, $oTitleCommonCss );

$query = wfArrayToCGI( array(
'usemsgcache' => 'yes',
'ctype' => 'text/css',
'smaxage' => $wgSquidMaxage
) + $siteargs );

$srcs[] = Title::newFromText( $articleName, NS_MEDIAWIKI)->getFullURL( $query );

// user specific CSS based on user preferences (if logged-in)
$siteargs['gen'] = 'css';
$siteargs['useskin'] = $skinname;
$srcs[] = Title::newFromText( '-' )->getFullURL( wfArrayToCGI( $siteargs ) );

wfProfileOut(__METHOD__);
return $srcs;
}

public static function getSiteJS( $combine ) {
return array(Title::newFromText('-')->getFullURL('action=raw&smaxage=0&gen=js&useskin=oasis'));
}
Expand Down Expand Up @@ -206,10 +174,4 @@ public function getGroupNames() {

return array_keys( $this->mConfig );
}

static public function isUserDependent( $oid ) {
return in_array( $oid, array(
'site_user_css',
));
}
}
15 changes: 0 additions & 15 deletions extensions/wikia/AssetsManager/AssetsManager_setup.php
Expand Up @@ -29,7 +29,6 @@

$wgAjaxExportList[] = 'AssetsManagerEntryPoint';
$wgHooks['MakeGlobalVariablesScript'][] = 'AssetsManager::onMakeGlobalVariablesScript';
$wgHooks['UserLoadFromSession'][] = 'AssetsManagerClearCookie';
$wgHooks['UserGetRights'][] = 'onUserGetRights';

/**
Expand All @@ -44,20 +43,6 @@ function onUserGetRights( $user, &$aRights ) {
return true;
}

/**
* @param User $user
* @param $result
* @return bool
*/
function AssetsManagerClearCookie( $user, &$result ) {
global $wgRequest;
if ( $wgRequest->getVal('action') === 'ajax' && $wgRequest->getVal('rs') === 'AssetsManagerEntryPoint'
&& !AssetsConfig::isUserDependent( $wgRequest->getVal('oid') ) ) {
$result = new User();
}
return true;
}

function AssetsManagerEntryPoint() {
global $wgRequest;
AssetsManagerServer::serve($wgRequest);
Expand Down
Expand Up @@ -28,11 +28,6 @@ public function __construct(WebRequest $request) {
// Start checking the url to see if it is something we care about (BugId:30188)
if(isset($params['action']) && $params['action'] == 'raw' && isset($params['gen']) && $params['gen'] == 'js') {
//$this->mContent .= RequestContext::getMain()->getSkin()->generateUserJs(); // FIXME
} else if(strpos($asset, 'Wikia.css') !== false) {
$message = wfMsgForContent('Wikia.css');
if(!wfEmptyMsg('Wikia.css', $message)) {
$this->mContent .= $message;
}
} else if(isset($params['action']) && $params['action'] == 'raw' && isset($params['gen']) && $params['gen'] == 'css') {
//$this->mContent .= RequestContext::getMain()->getSkin()->generateUserStylesheet(); // FIXME
} else {
Expand Down Expand Up @@ -63,15 +58,5 @@ public function __construct(WebRequest $request) {
$this->mContent = preg_replace('#^.*@Packager\\.RemoveLine.*$#m', '', $this->mContent);
$this->mContent = str_replace("\xEF\xBB\xBF" /* BOM */, '', $this->mContent);
}

if($this->mOid == 'site_user_css') {
$this->mCacheMode = 'private';
}
}

// vary by Cookie as well when serving site_user_css group
public function getVary() {
$isCookieDependent = AssetsConfig::isUserDependent($this->mOid);
return $isCookieDependent ? 'Cookie,Accept-Encoding' : 'Accept-Encoding';
}
}
16 changes: 0 additions & 16 deletions extensions/wikia/AssetsManager/config.php
Expand Up @@ -146,22 +146,6 @@
)
);

/** Site specific CSS **/
$config['site_anon_css'] = array(
'type' => AssetsManager::TYPE_CSS,
'assets' => array(
'#function_AssetsConfig::getSiteCSS'
)
);

/** User specific CSS **/
$config['site_user_css'] = array(
'type' => AssetsManager::TYPE_CSS,
'assets' => array(
'#group_site_anon_css',
)
);

/**
* Scripts that are needed very early in execution and thus are worth blocking for.
*
Expand Down
3 changes: 1 addition & 2 deletions skins/LyricsMinimal.php
Expand Up @@ -699,8 +699,7 @@ function execute() {

// Site-CSS.
global $wgUser, $wgStylePath, $wgJsMimeType;
$srcs = AssetsManager::getInstance()->getGroupLocalURL($wgUser->isLoggedIn() ? 'site_user_css' : 'site_anon_css');
$srcs[] = $wgStylePath."/lyricsminimal/article.css"; // Probably ghetto. This whole skin needs to just be rewritten as Oasis modifications anyway though.
$srcs = [ $wgStylePath."/lyricsminimal/article.css" ]; // Probably ghetto. This whole skin needs to just be rewritten as Oasis modifications anyway though.
foreach($srcs as $src) {
echo '<link rel="stylesheet" href="'. htmlspecialchars( $src ) .'">';
}
Expand Down
5 changes: 0 additions & 5 deletions skins/campfire/modules/templates/Campfire_Index.php
Expand Up @@ -11,11 +11,6 @@
<?= $csslinks ?>
<?php
global $wgUser;
// $srcs = AssetsManager::getInstance()->getGroupLocalURL($wgUser->isLoggedIn() ? 'site_user_css' : 'site_anon_css');
// foreach($srcs as $src) {
// echo '<link rel="stylesheet" href="'.$src.'">';
// }

// RT #68514: load global user CSS
if ($pagecss != '') {
?>
Expand Down