Page MenuHomePhabricator

CLI installer failure: Could not insert main page: Invalid callback SFFormUtils::purgeCache in hooks for ArticleSave
Open, Needs TriagePublic

Description

Steps taken:

git checkout of the MediaWiki core (bb3da3829714d17315986b517e5286d73cd2953e).

My composer.local.json:

`
{
	"require": {
		"mediawiki/semantic-forms": "3.3.2"
	}
}
`

Ran composer install and after this

`
php -c "${HOME}/php.ini"  maintenance/install.php --dbtype="mysql" --dbname=sf \
	--dbuser=wikiuser --dbpass=${pass} \
	--installdbuser=${iuser} --installdbpass=${ipass} \
	--server http://tools.wikimedia.pl --scriptpath "${script}" \
	--showexceptions=true --pass XXXX mysqltest WikiAdmin
`

The result:

`
Script started on Sat Dec 12 21:45:00 2015
PHP 5.6.9-pl0-gentoo is installed.
Warning: Could not find APC, XCache or WinCache.
Object caching is not enabled.
Found ImageMagick: /usr/bin/convert.
Image thumbnailing will be enabled if you enable uploads.
Found the Git version control software: /usr/bin/git.
Using server URL "http://tools.wikimedia.pl/trunk/w".
Warning: Your default directory for uploads (/usr/home/saper/public_html/sf/images/) is not checked for vulnerability
to arbitrary script execution during the CLI install.
Using the intl PECL extension for Unicode normalization.
The environment has been checked.
You can install MediaWiki.
Setting up database
done
Creating tables
done
Creating database user
done
Populating default interwiki table
done
Initializing statistics
done
Generating secret keys
done
Prevent running unneeded updates
done
Creating administrator user account
done
Creating main page with default content
Could not insert main page: Invalid callback SFFormUtils::purgeCache in hooks for ArticleSave

RC: 1
A copy of your installation's LocalSettings.php
must exist and be readable in the source directory.
Use --conf to specify it.

Script done on Sat Dec 12 21:45:38 2015
`
`

Event Timeline

saper created this task.Dec 12 2015, 8:50 PM
saper raised the priority of this task from to Needs Triage.
saper updated the task description. (Show Details)
saper added a subscriber: saper.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptDec 12 2015, 8:50 PM
saper added a comment.Dec 12 2015, 8:55 PM

Same with Semantic Forms master (46d3369c31543ef159c0dc5dbd4460aa001ea6f4)

saper set Security to None.
saper added a comment.EditedDec 12 2015, 9:45 PM

This is probably because files composer autoload clause causes PHP to require SemanticForms.php, which installs very early.

The workaround is to remove the SMW/SF dependency from composer.local.json, install the wiki, add the dependencies, run update.php

Change 258676 had a related patch set uploaded (by Paladox):
Fix extension registration support

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

The purgeCache function is invalid for hook ArticleSave please see manual at https://www.mediawiki.org/wiki/Manual:Hooks/ArticleSave

Paladox added a subscriber: Yaron_Koren.EditedDec 15 2015, 9:09 AM

@Yaron_Koren can I add you too task please this seems to need to be fixed.

Paladox added a subscriber: Yaron_Koren.

Yes, sure. I don't know much about the Composer stuff, though, so I don't know if I can help here.

Paladox added a comment.EditedDec 15 2015, 1:44 PM

@Yaron_Koren Here I am getting a different message.

https://integration.wikimedia.org/ci/job/mwext-testextension-zend-composer/504/console

11:50:04 Could not insert main page: A database error has occurred. Did you forget to run maintenance/update.php after upgrading? See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
11:50:04 Query: SELECT smw_id,smw_sortkey FROM smw_object_ids WHERE smw_title = 'Main_Page' AND smw_namespace = '0' AND smw_iw = AND smw_subobject = LIMIT 1
11:50:04 Function: SMWSql3SmwIds::getDatabaseIdAndSort
11:50:04 Error: 1146 Table 'jenkins_u1_mw.smw_object_ids' doesn't exist (127.0.0.1:3306)

It fails the composer extension unit test test. Which test against semantic mediawiki.

https://gerrit.wikimedia.org/r/#/c/258676/

Change 262150 had a related patch set uploaded (by Paladox):
Use hook ArticleSave only if you use mw 1.21 or lower and use PageContentSaveComplete if you use mw 1.22 or higher

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

I doint think it is related to composer. The extension is using a deprecated hook. So I added and if and else check so that if you use mw 1.21 or lower then it would use the deprecated hook if you use mw 1.22 or higher then it would use the new hook.

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

I haven't tested. But seems to works now even though it fails at Could not insert main page: A database error has occurred. Did you forget to run maintenance/update.php after upgrading? but all the extensions are doing that so doesn't matter. It only fails at the composer unit tests so if they install semantic mediawiki then the extension should install fine.

@saper could you test my patch I uploaded please.

Change 258676 merged by Yaron Koren:
Fix extension registration support

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

Could this have a high priorty since it seems to be broken in composer.

https://integration.wikimedia.org/ci/job/mwext-testextension-hhvm-composer/1193/console

Change 270588 had a related patch set uploaded (by Paladox):
Remove hook ArticleSave

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

Change 270588 merged by Yaron Koren:
Remove hook ArticleSave

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

Paladox added a subscriber: Kghbln.Feb 26 2016, 6:36 PM

@Kghbln can you confirm that the above patch fixes the problem for you.

Please download straight off the master branch instead of the releases since they wont have the fix yet.

@Paladox Currently I cannot test since I am still on Debian 7 so master will not work for me. :|

@Kghbln oh so it wont work on Debian 7 do you know why. Does it bring up errors.

MW master requires PHP 5.5.9+ so it will not run on PHP 5.4

@Kghbln but SemanticForms is not made for php 5.5 only. So should work as long as you doint upgrade your mediawiki version. But mediawiki 1.27 wmf 12 should work for you since the upgrade to php 5.5 was made in wmf14 but some changes were done before hand in wmf 13.

@Kghbln I'm running mediawiki 1.27 wmf 13 on my wiki running php 5.3.8 but some of the php 5.5 were in that release so I had to update one of the files manually to stay compatible with php 5.3, so I recommend using mediawiki 1.27 wmf 12 for testing.

Change 262150 abandoned by Paladox:
Use hook ArticleSave only if you use mw 1.21 or lower and use PageContentSave if you use mw 1.22 or higher

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