Page MenuHomePhabricator

ResourceLoaderStartUpModule broken in mediawiki 1.26 wmf 7
Closed, InvalidPublic

Description

Hi there is a problem with extension registration because skins are not working with javascript seems the styles load but not javascript. it was since upgrading to wmf 7 I have had this problem so not code problem with skin. but I have tested it with metrolook and seems to not work but worked in wmf6 and vector which seems to work but broken in wmf 7

Please visit these two websites

http://en.random-wikisaur.tk
http://pt-br.random-wikisaur.tk

and problem may happen to other skins I haven't tested any others.

Event Timeline

Paladox raised the priority of this task from to Needs Triage.
Paladox updated the task description. (Show Details)
Paladox added subscribers: Paladox, Legoktm.

Resource loader is broken I haven't tested extension since js ident working.

Change 212790 had a related patch set uploaded (by Paladox):
Revert "resourceloader: Replace timestamp system with version hashing"

https://gerrit.wikimedia.org/r/212790

Looking at http://en.random-wikisaur.tk/load.php?debug=false&lang=en&modules=startup&only=scripts&skin=metrolook&*

Fatal error: Call to undefined method ResourceLoader::makeHash() in /home/simplera/public_html/en/includes/resourceloader/ResourceLoaderModule.php on line 471

It looks like you updated ResourceLoaderModule.php to master, but not ResourceLoader.php. Otherwise the method would exist. I think it's a problem on your side.

This has nothing to do with extension registration, by the way, as far as I can tell.

It has to do with public static function getStartupModulesUrl( ResourceLoaderContext $context ) {

since doing this

/**

  • Get the load URL of the startup modules. *
  • This is a helper for getScript(), but can also be called standalone, such
  • as when generating an AppCache manifest. *
  • @param ResourceLoaderContext $context
  • @return string
	 */

public static function getStartupModulesUrl( ResourceLoaderContext $context ) {

		$moduleNames = self::getStartupModules();

		// Get the latest version 
		$loader = $context->getResourceLoader();
		$version = 1;
		foreach ( $moduleNames as $moduleName ) {
			$version = max( $version,
				$loader->getModule( $moduleName )->getModifiedTime( $context )
			);
		}

		$query = array(
			'modules' => ResourceLoader::makePackedModulesString( $moduleNames ),
			'only' => 'scripts',
			'lang' => $context->getLanguage(),
			'skin' => $context->getSkin(),
			'debug' => $context->getDebug() ? 'true' : 'false',
			'version' => wfTimestamp( TS_ISO_8601_BASIC, $version )
		);
		// Ensure uniform query order
		ksort( $query );
		return wfAppendQuery( wfScript( 'load' ), $query );

}

not

/**

  • Get the load URL of the startup modules. *
  • This is a helper for getScript(), but can also be called standalone, such
  • as when generating an AppCache manifest. *
  • @param ResourceLoaderContext $context
  • @return string
	 */

public static function getStartupModulesUrl( ResourceLoaderContext $context ) {

		$rl = $context->getResourceLoader();
		$moduleNames = self::getStartupModules();

		$query = array(
			'modules' => ResourceLoader::makePackedModulesString( $moduleNames ),
			'only' => 'scripts',
			'lang' => $context->getLanguage(),
			'skin' => $context->getSkin(),
			'debug' => $context->getDebug() ? 'true' : 'false',
			'version' => $rl->getCombinedVersion( $context, $moduleNames ),
		);
		// Ensure uniform query order
		ksort( $query );
		return wfAppendQuery( wfScript( 'load' ), $query );

}

worked for me. It worked in wmf 6 and I am not using master I am using wmf7.

Change 212796 had a related patch set uploaded (by Paladox):
Fix js problem in ResourceLoaderStartUpModule

https://gerrit.wikimedia.org/r/212796

Change 212796 had a related patch set uploaded (by Paladox):
Fix js problem in ResourceLoaderStartUpModule

https://gerrit.wikimedia.org/r/212796

Paladox renamed this task from extension registration broken in mediawiki 1.26 wmf 7 using skins. to ResourceLoaderStartUpModule broken in mediawiki 1.26 wmf 7.May 22 2015, 7:41 PM
Krinkle closed this task as Declined.EditedMay 23 2015, 11:52 AM
Krinkle claimed this task.

It has to do with public static function getStartupModulesUrl( ResourceLoaderContext $context ) {

since doing this [..]

No, it does not have to do with getStartupModulesUrl.

Your installation of MediaWiki is broken. It appears you have corrupted or outdated versions of some MediaWiki files. If you do not solve this problem, all your bug reports will be useless.

Because of the file corruption on your server, functions are not able to call other functions. "Startup module" is one of the first functions in MediaWiki. So you see "getStartupModulesUrl" in the error, but that is not where the problem is.

Everybody else who is using MediaWiki does not have this problem. If the problem were really in "getStartupModulesUrl", then other people would have it too.

Hi I have redownloaded mediawiki wmf 7 twice and problem didn't happen in wmf 6 and my mediawiki is not corrupted because I have redone it over and over and still have had problem. But witht his single patch https://gerrit.wikimedia.org/r/#/c/212796/ fixed problem for me so it is in the ResourceLoaderStartUpModule php file.

Change 212796 abandoned by Krinkle:
Fix javascript problem in ResourceLoaderStartUpModule

Reason:
This code is broken and fails all tests. It is adding calls to timestamp-systems in a resourceloader context that does not support any such thing.

As explained in T99988, this only works for you because one of your files got corrupted. Please fix your MediaWiki install first. If you are using git, be sure to git-pull the latest master from gerrit, and to make sure "git status" reports no errors.

If you are using tar-ball downloads, be sure to verify your download is not corrupt and make sure any old files are overwritten when updating.

Using old versions of MediaWiki is okay, but at this point you are using some internal files new, and some internal files old. That is not okay.

https://gerrit.wikimedia.org/r/212796

I even deleted my mediawiki file and then reuploaded a new copy of mediawiki 1.26 wmf 7 to my website.

Hi I doint use git when updating I do it manualy from github I go to branch wmfx like wmf7

But why does it add &* to end.

@Krinkle how can I track where the problem happens so I can update the file because it seems resourceloaderstartup php file is the only file causing problem.

Change 212796 restored by Paladox:
Fix javascript problem in ResourceLoaderStartUpModule

Reason:
Not my website I have double checked but mediawiki seem to be able to ignor there errors because somemtimes there are errors on other people websites and not on others. I am having this problem on both my website since updating from wmf 6 to wmf 7 of 1.26 both on same folder but in different folder. it carnt be corrupted download since I tried in ie and edge on windows 10 preview. And when I use this version patch it works so it ResourceLoaderStartup has to be fixed.

https://gerrit.wikimedia.org/r/212796

Not to do with my website because if it was then why did it work in wmf 6 and not wmf 7

The problem is happening on all my domains I updated to wmf 7 some are on different servers.

This comment was removed by Paladox.

It is a problem with mediawiki.

I am using php 5.5 and MySQL 5.6. load.php download the load.js file but it is empty. meaning js error and not my wiki setup. tried it on multiple servers.

This comment was removed by Paladox.

Hi its this code

			$versionHash = $module->getVersionHash( $context );
			if ( strlen( $versionHash ) !== 8 ) {
				// Module implementation either broken or deviated from ResourceLoader::makeHash
				// Asserted by tests/phpunit/structure/ResourcesTest.
				$versionHash = ResourceLoader::makeHash( $versionHash );
			}

causing problem if replaced with $moduleMtime = wfTimestamp( TS_UNIX, $module->getModifiedTime( $context ) );

it works.

On line 208 in resourceloderstartup

Change 213002 had a related patch set uploaded (by Paladox):
Fix javascript problem in ResourceLoaderStartUpModule

https://gerrit.wikimedia.org/r/213002

Change 213002 abandoned by Krinkle:
Fix javascript problem in ResourceLoaderStartUpModule

Reason:
This breaks ResourceLoader and makes no sense. getVersionHash does much more than just call getDefinitionSummary. If getVersionHash() is not working, then your server is broken. I've explained this on the phrabricator task and other patches already.

https://gerrit.wikimedia.org/r/213002

Change 212796 abandoned by Krinkle:
Fix javascript problem in ResourceLoaderStartUpModule

Reason:
Per Ia0e1fb89da3903. This introduces an isolated logic duplication focussing only on timestamps, which are no longer used by ResourceLoader. This will cause failed deployments and out of date cache.

getVersionHash() does more than just time computation, and it is being used intentionally. There is no reason to change this.

https://gerrit.wikimedia.org/r/212796

Change 212790 abandoned by Krinkle:
Revert "resourceloader: Replace timestamp system with version hashing"

Reason:
I don't know how to fix the problem you are seeing. However I've asked numerous other people and nobody has this problem. You may want to do an integrity check and ensure all files are up to date from the latest master and/or the same MediaWiki version you are using.

You could ask for help at https://www.mediawiki.org/wiki/Project:Support_desk if you need assistance. However considering the kind of errors you are getting, I don't think anyone can help you at this point. It seems there is file corruption, which is not related to MediaWiki. It relates to your webserver.

https://gerrit.wikimedia.org/r/212790

Chaning

if ( !array_key_exists( $contextHash, $this->versionHash ) ) {

to

if ( array_key_exists( $contextHash, $this->versionHash ) ) {

fixed problem

so by removing ! fixed problem.

Change 213254 had a related patch set uploaded (by Paladox):
Remove ! from if ( !array_key_exists( $contextHash, $this->versionHash ) ) {

https://gerrit.wikimedia.org/r/213254

Hi what about doing if (!array_key_exists($contextHash, $this->versionHash) AND array_key_exists($contextHash, $this->versionHash)) {

That wouldn't make any sense, you would check, if the result of array_key_exists with the same parameters is one time false and one time true.

I suggest you check the points, @Krinkle already mentioned to you.

Ok It seems my website on a different webhost works so its a server problem. how can I track where problem happends on server I doint have any access to server but I have my  website and would like to find out where problem happends. I am running php 5.5 and MySQL 5.6.

Change 213254 abandoned by Krinkle:
Remove ! from if ( !array_key_exists( $contextHash, $this->versionHash ) ) {

Reason:
Okay, I'll close this per your comment.

https://gerrit.wikimedia.org/r/213254

Hi it seems that the update you did to resourceloader broke website that say object cache is not enabled and websites that have cannot find xCache and the other cache software.

Hi I think my website is not correctly generating the hash and storing it on server that is why when I remove ! it works. do you know why it would not generate or how I can fix it or the web host can fix it.

@Paladox: Please stop adding comments here and please stop ignoring reading comments like T99988#1307250. For consequences of continuous persistent disregard, see the etiquette.

Find why it woulden work I was using an outdated version of SyntaxHighlight_GeShi and since that extension has built in resource loader and was looking for old code in core of mediawiki it broke javascript but as soon as I updated the extension all my website javascript started working again.