Extension talk:Favorites

About this board

File "extension.json" doesn't exist in 1.34

2
WhitWye (talkcontribs)

The error begins: "Fatal error: Uncaught Exception: Unable to open file /var/www/mediawiki-1.34.0/extensions/Favorites/extension.json ... and indeed the only .json files in the Favorites folder (from the current tar download) are composer.json, gitinfo.json, package-lock.json and package.json. Should one of those be symlinked as "extension.json"?


Note that was with the new way. The old spec of 'require_once "$IP/extensions/Favorites/Favorites.php";' doesn't error out on that nonexistent file, but instead, "

No such action


The action specified by the URL is invalid. You might have mistyped the URL, or followed an incorrect link. This might also indicate a bug in the software used by eiswiki.

Lwangaman (talkcontribs)

I am now trying to install the Favorites extension. When I run the "php update.php" in the maintenance folder I get the same error:

PHP Fatal error: Uncaught Exception: Unable to open file /var/www/vhosts/.../extensions/Favorites/extension.json: filemtime(): stat failed for /var/www/vhosts/.../extensions/Favorites/extension.json in /var/www/vhosts/.../includes/registration/ExtensionRegistry.php:136 Stack trace:

  1. 0 /var/www/vhosts/.../includes/GlobalFunctions.php(52): ExtensionRegistry->queue()
  2. 1 /var/www/vhosts/.../LocalSettings.php(177): wfLoadExtension()
  3. 2 /var/www/vhosts/.../includes/Setup.php(124): require_once('/var/www/vhosts...')
  4. 3 /var/www/vhosts/.../maintenance/doMaintenance.php(83): require_once('/var/www/vhosts...')
  5. 4 /var/www/vhosts/.../maintenance/update.php(277): require_once('/var/www/vhosts...')
  6. 5 {main}
 thrown in /var/www/vhosts/.../includes/registration/ExtensionRegistry.php on line 136

Anyone have a fix?

Reply to "File "extension.json" doesn't exist in 1.34"
Silkwood (talkcontribs)
Product Version
MediaWiki 1.32.0
PHP 7.2.17-0ubuntu0.18.04.1 (apache2handler)
MariaDB 10.1.38-MariaDB-0ubuntu0.18.04.1

Installed the last version of Favourites and run the maintenance/update.php, I get this error using the extension (i.e. clicking on the star icon):

No such action

The action specified by the URL is invalid. You might have mistyped the URL, or followed an incorrect link. This might also indicate a bug in the software used by ....

and the "mistyped" url is:

https://tunearch.org/w/index.php?title=Harlequin_Tune_(3)&action=favorite&token=8506e116643ceea83a82e35f8987a3ee5ce2b492%2B%5C



Brickscrap (talkcontribs)

I get the same, did you ever find a fix?

Silkwood (talkcontribs)

Unfortunately, not.

Silkwood (talkcontribs)

Did someone find a solution to this problem?

I tried the 1.1.3 version (cloning gerrit repo) but I got the same error: "No such action".

Please help!

Reply to "No such action in MW 1.32"

Javascript error: Exception in module-execute in module ext.favorites

1
S0ring (talkcontribs)

When any Wiki page is called (MW 1.31, Favorites 1.1.2) Chrome reports the following console error:


JQMIGRATE: Migrate is installed with logging active, version 3.0.1

Exception in module-execute in module ext.favorites:

TypeError: Cannot set property 'favorite' of undefined

   at load.php?debug=false&lang=de&modules=ext.favorites|skins.pivot.js&skin=pivot&version=1h4he9h:2

   at mw.loader.implement.addedfavoritetext (load.php?debug=false&lang=de&modules=ext.favorites|skins.pivot.js&skin=pivot&version=1h4he9h:3)

   at runScript (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=pivot&version=0hrympo:162)

   at checkCssHandles (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=pivot&version=0hrympo:162)

   at execute (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=pivot&version=0hrympo:163)

   at handlePending (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=pivot&version=0hrympo:159)

   at markModuleReady (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=pivot&version=0hrympo:161)

   at runScript (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=pivot&version=0hrympo:162)

   at checkCssHandles (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=pivot&version=0hrympo:162)

   at execute (load.php?debug=false&lang=de&modules=jquery%2Cmediawiki&only=scripts&skin=pivot&version=0hrympo:163)

JQMIGRATE: jQuery(window).on('load'...) called after load event occurred

Reply to "Javascript error: Exception in module-execute in module ext.favorites"

Undefined method User::getSkin() in MW 1.28

2
TyrelHa (talkcontribs)

We recently upgraded to MW 1.28.0 from 1.25.0, and we're getting this error when trying to access the "My favorites" page:

PHP Fatal error:  Call to undefined method User::getSkin() in /srv/www/devwiki/extensions/Favorites/SpecialFavoritelist.php on line 94

This results in a 500 Internal Server Error and all users cannot access their favorites.

The method User::getSkin has been deprecated since 1.18. The code comment says to "use ->getSkin() in the most relevant outputting context you have."

I changed all instances of $this->user->getSkin() to $this->context->getSkin() on my copy of the extension, and now it seems to work fine.

JulieC (talkcontribs)

Thank you for the breadcrumb! I'm upgrading 1.17.0 to 1.29.3 in a time when 1.33.0 is king. Some additional help for the next person:

Outside of a class context, you can replace with: $sk = RequestContext::getMain()->getSkin();

And a useful manual page: https://www.mediawiki.org/wiki/Manual:RequestContext.php

Reply to "Undefined method User::getSkin() in MW 1.28"

Bugged display in Installation section

2
134.106.87.67 (talkcontribs)

Is it just me or is the Installation section bugged? I see things like

1>download-link</> and place the file(s) in a directory called <tvar|name>Favorites</> in your <tvar|ext>extensions/</> folder.</translate>

Can someone fix this? Also the download link is not given!

Jlemley (talkcontribs)

Fixed - thank you!

i18n - German Translation available

3
195.182.60.200 (talkcontribs)

With this post I provide a german translation of the en.json file provided within the favorites project. Perhaps it can be part of the project source.

Please feel free to add this as "de.json" in the folder Favorites/i18n/:

{

   "@metadata": {
       "authors": ["Tim Koester"]
   },
   "favorites-desc": "Erstelle Favoriten-Liste",
   "favoritethis"                       : "Zu Favoriten hinzufügen",
   "prefs-favoritelist"              : "Favoriten",
   "prefs-favoritelist-token"        : "Favoriten token:",
   "prefs-advancedfavoritelist"      : "Erweiterte Optionen",
   "favoritelist"           : "Favoriten",
   "myfavoritelist"         : "Favoriten",
   "favoritelistfor"        : "(for $1)",
   "nofavoritelist"         : "You have no items in your favorites.",
   "favoritelistanontext"   : "Bitte $1 um Favoriten anzuzeigen oder zu bearbeiten.",
   "favoritenologin"        : "Anmeldung erforderlich",
   "favoritenologintext"    : "Sie müssen angemeldet sein, um mit Favoriten zu arbeiten.",
   "addedfavorite"          : "Zu Favoriten hinzugefügt",
   "addedfavoritetext"      : "Die Seite $1 wurde zu ihren Favoriten hinzugefügt.",
   "removedfavorite"        : "Aus Favoriten entfernt",
   "removedfavoritetext"    : "Die Seite $1 wurde aus ihren Favoriten entfernt.",
   "favorite"               : "+Favorit",
   "favoritethispage"       : "Zu Favoriten hinzufügen.",
   "unfavorite"             : "-Favorit",
   "unfavoritethispage"     : "Aus Favoriten entfernen.",
   "favoritelist-options"   : "Favoriten Optionen",
   "favoriteerrortext"         : "Ein Fehler trat auf beim Ändern der Favoriten Einstellungen für $1.",
   "unfavoriteing"             : "Entfernen ...",
   "favoriteing"             : "Hinzufügen ...",
   "tooltip-pt-favoritelist": "Liste der Seite, deren Änderungen sie überwachen.",
   "tooltip-ca-favorite"      : "Fügt diese Seite zu ihren Favoriten hinzu.",
   "tooltip-ca-unfavorite"  : "Entfernt diese Seite aus ihren Favoriten.",
   "tooltip-favorite"          : "Fügt diese Seite zu ihren Favoriten hinzu.",
   "favoritelistedit-numitems"    : "Ihre Favoritenliste enthält $1 Titel.",
   "favoritelistedit-noitems" : "Your favorites contain no titles.",
   "favoritelistedit-normal-title" : "Favoriten bearbeiten",
   "favoritelistedit-normal-legend" : "Titel aus den Favoriten entfernen",
   "favoritelistedit-normal-explain" : "Titel in den Favoriten werden unten angezeigt. 
Zu entfernende Titel mittels Checkbox markieren und mit Button '<Favoritelistedit-normal-submit>' entfernen.
Alternativ können Sie den Quelltext editieren.
", "favoritelistedit-normal-submit" : "Titel entfernen", "favoritelistedit-normal-done" : "$1 titles were removed from your favorites:", "favoritelistedit-raw-title" : "Quelltext der Favoritenliste bearbeiten", "favoritelistedit-raw-legend" : "Quelltext bearbeiten", "favoritelistedit-raw-explain" : "Dit Titel ihrer Favoritenliste werden unten angezeigt. Sie können Titel aus der Liste löschen oder auch weitere Titel hinzufügen. Jeder Titel steht dabei einzeln in einer Zeile.
Nach Abschluss der Bearbeitung auf Button '<Favoritelistedit-raw-submit>' klicken.

Sie können auch die normale Bearbeitungsseite wählen.
", "favoritelistedit-raw-titles" : "Titel:", "favoritelistedit-raw-submit" : "Favoriten aktualisieren", "favoritelistedit-raw-done" : "Ihre Favoriten wurden aktualisiert.", "favoritelistedit-raw-added" : "$1 Titel wurde hinzugefügt:", "favoritelistedit-raw-removed" : "$1 Titel wurde entfernt:", "favoritelisttools-view" : "Favoriten anzeigen", "favoritelisttools-edit" : "Favoriten anzeigen und bearbeiten", "favoritelisttools-raw" : "Favoriten Quelltext bearbeiten"

}

Shirayuki (talkcontribs)
Jkmartindale (talkcontribs)

I just sent a commit to Gerrit. Now we just gotta wait for it to be merged. Thanks for your work!

Reply to "i18n - German Translation available"
Baumgeist (talkcontribs)

(really hating this discussion system) Setting $wgFavoritesPersonalURL = true; messes up the keys of the other links, so I copied some code from Extension:AdminLinks to fix that. Find:

		if ( $wgFavoritesPersonalURL && $wgUser->isLoggedIn() ) {
			$url['userpage'] = array_shift( $personal_urls );
			$url[] = array_shift( $personal_urls );
			$url[] = array_shift( $personal_urls );
	
			$url[] = array( 'text' => wfMessage( 'myfavoritelist' )->text(),
					'href' => SpecialPage::getTitleFor( 'Favoritelist' )->getLocalURL() );
			$personal_urls = $url + $personal_urls;
		}

Replace with:

    //taken from AdminLinks_body.php of the AdminLinks-Extension
		if ( $wgFavoritesPersonalURL && $wgUser->isLoggedIn() ) {
			$al = SpecialPage::getTitleFor( 'Favoritelist' );
			$href = $al->getLocalURL();
			$favorites_vals = array(
				'text' => wfMessage( 'myfavoritelist' )->text(),
				'href' => $href,
				'active' => ( $href == $wgTitle->getLocalURL() )
			);

			// find the location of the 'my preferences' link, and
			// add the link to 'AdminLinks' right before it.
			// this is a "key-safe" splice - it preserves both the
			// keys and the values of the array, by editing them
			// separately and then rebuilding the array.
			// based on the example at http://us2.php.net/manual/en/function.array-splice.php#31234
			$tab_keys = array_keys( $personal_urls );
			$tab_values = array_values( $personal_urls );
			$watch_location = array_search( 'watchlist', $tab_keys );
			array_splice( $tab_keys, $watch_location, 0, 'Favoritelist' );
			array_splice( $tab_values, $watch_location, 0, array( $favorites_vals ) );

			$personal_urls = array();
			for ( $i = 0; $i < count( $tab_keys ); $i++ ) {
				$personal_urls[$tab_keys[$i]] = $tab_values[$i];
			}
		}

Jkmartindale (talkcontribs)

I did something similar. To add the Favorites link after the Watchlist link, all you need to do is edit FavoritesHooks.php from

 92 public static function onPersonalUrls( &$personal_urls, &$title ) {
 93 	global $wgFavoritesPersonalURL, $wgUser;
 94 
 95 	if ( $wgFavoritesPersonalURL && $wgUser->isLoggedIn() ) {
 96 		$url['userpage'] = array_shift( $personal_urls );
 97 		$url[] = array_shift( $personal_urls );
 98 		$url[] = array_shift( $personal_urls );
 99 
100 		$url[] = array( 'text' => wfMessage( 'myfavoritelist' )->text(),
101 				'href' => SpecialPage::getTitleFor( 'Favoritelist' )->getLocalURL() );
102 		$personal_urls = $url + $personal_urls;
103 	}
104 
105 	return true;
106 }

to

 92 public static function onPersonalUrls( &$personal_urls, &$title ) {
 93 	global $wgFavoritesPersonalURL, $wgUser;
 94 
 95 	if ( $wgFavoritesPersonalURL && $wgUser->isLoggedIn() ) {
 96 		$url[] = array( 'text' => wfMessage( 'myfavoritelist' )->text(),
 97 				'href' => SpecialPage::getTitleFor( 'Favoritelist' )->getLocalURL() );
 98 		$personal_urls = wfArrayInsertAfter( $personal_urls, $url, 'watchlist' );
 99 	}
100 
101 	return true;
102 }
Reply to "Bugfix"

Call to undefined function wfMsg()

4
Summary by Jkmartindale

Fixed in r262067

Mkepler (talkcontribs)

Mediawiki 1.27

PHP Fatal error:  Call to undefined function wfMsg() in /path/to/wiki/extensions/Favorites/FavParser.php on line 32

Mkepler (talkcontribs)

Cause: edit page, and submit.

Mkepler (talkcontribs)

Solution: replace wfMsg wfMessage

Mkepler (talkcontribs)

Error on Empty Favorites List [MW1.27.1]

2
Jkmartindale (talkcontribs)

I created an empty page with <favorites editlink=true /> when I had an empty favorites list, and it resulted in Error from line 145 of extensions/Favorites/FavParser.php: Call to undefined method FavParser::msg().

Jkmartindale (talkcontribs)
Solution

Edit line 145 of FavParser.php:

138 private function showNormalForm( $output, $user ) {
139 
140 	if ( $this->countFavoritelist($user ) > 0 ) {
141 		$form = $this->buildRemoveList( $user );
142 		$output .=  $form ;
143 		return $output;
144 	} else {
145 		$output = $this->msg('nofavoritelist')->text();
146 		return $output;
147 	}
148 }

to

145 		$output = wfMessage('nofavoritelist')->text();
Reply to "Error on Empty Favorites List [MW1.27.1]"

$wgUseIconFavorite and $wgFavoritesPersonalURL don't work!

3
Fokebox (talkcontribs)

1) $wgUseIconFavorite = true; and $wgFavoritesPersonalURL = true; dont't work at my wiki! I use Mediawiki 1.18.3 2) Shall I launch update.php after installation, if I have updated mysql manually? What do I have to do?

Fokebox (talkcontribs)

Well it does work =) I had worng order in php ) But it is displayed not like on the screen shot of the example page

Add caption here

I have marked a red line what looks wrong There is also a strange line in the bottom of my favorite page

Add caption here

And I had to chage SpecialFavoritelist.php ('Xml::hidden' to 'Html::hidden'), 'caouse there was a php error.

Fokebox (talkcontribs)

Well it does work =) I had worng order in php ) But it is displayed not like on the screen shot of the example page

Add caption here

I have marked a red line what looks wrong There is also a strange line in the bottom of my favorite page

Add caption here

And I had to chage SpecialFavoritelist.php ('Xml::hidden' to 'Html::hidden'), 'caouse there was a php error.

Reply to "$wgUseIconFavorite and $wgFavoritesPersonalURL don't work!"
Return to "Favorites" page.