[Solved] Gallery unuseable because of missing Plugin

The_Judge

Joined: 2011-08-27
Posts: 3
Posted: Sat, 2011-08-27 20:33

I have a Problem with Gallery2 and hope that someone might help.
I had installed the Plugin "reCaptcha" ( http://codex.gallery2.org/Gallery2:Modules:recaptcha#Installation ) in a gallery2 instance once. Now I have ported the Installation to a new server and switched to the version of gallery2 from the Package Management. It is the same version, I ran on the old server from source.
But without that module, my gallery acts weird. For example, when a User tries to login:

Quote:
Error
An error has occurred.

Back to the Gallery

Error Detail -
Error (ERROR_BAD_PATH) : Invalid path: modules/recaptcha/classes/ReCaptchaValidationPlugin.inc
in modules/core/classes/helpers/GalleryFactoryHelper_simple.class at line 171 (GalleryCoreApi::error)
in modules/core/classes/helpers/GalleryFactoryHelper_simple.class at line 201 (GalleryFactoryHelper_simple::newInstance)
in modules/core/classes/GalleryCoreApi.class at line 175 (GalleryFactoryHelper_simple::newInstanceById)
in modules/core/UserLogin.inc at line 115 (GalleryCoreApi::newFactoryInstanceById)
in main.php at line 250 (UserLoginController::handleRequest)
in main.php at line 104
in main.php at line 88

The module "recaptcha" has been deleted during the server move, so the error "invalid path" is true. But it isn't available at the listed location anymore; neither could I find the plugin on the web somewhere.

I already tried to change the field "g_active" in the table "g2_PluginMap" in mysql, but that didn't change a thing.

Does anybody have a hint for me how to solve this? Or why gallery is still searching for this plugin , even after it is missing in FS and deactivated in the DB?


Gallery version : 2.3.1
PHP version (e.g. 5.1.6): 5.3.8
PHPInfo Link (see FAQ): http://www.leliel.info/gallery/infox.php
Webserver (e.g. Apache 1.3.33): 2.2.17
Database (e.g. MySql 5.0.32): 5.1.56
Activated toolkits (e.g. NetPbm, GD): Don't know anymore, since I cannot login to Gallery anymore
Operating system (e.g. Linux): Gentoo Linux
Browser (e.g. Firefox 2.0): All

Login or register to post comments
Dayo

Joined: 2005-11-04
Posts: 1132
Posted: Sat, 2011-08-27 20:58

That'll be because the module probably has some factory registrations etc active.

Put the code below temporarily somewhere in the G2 process flow and then navigate to your site to deactivate it.

$pluginType = 'module';
$pluginId = 'recaptcha';
$ret = GalleryCoreApi::unregisterToolkitsByModuleId($pluginId);
$ret = GalleryCoreApi::unregisterFactoryImplementationsByModuleId($pluginId);
$ret = GalleryCoreApi::updateMapEntry('GalleryPluginMap', array('pluginType' => $pluginType, 'pluginId' => $pluginId), array('active' => 0));

You can try after

function _GalleryMain($embedded=false, $template=null) {
    global $gallery;
    $urlGenerator =& $gallery->getUrlGenerator();

in your main.php.

You paste it there, save the file, navigate to G2 so that it runs and then remove it. You should then be able to delete the module in the G2 admin so as to remove it completely from your database.

--
dakanji.com

Login or register to post comments
The_Judge

Joined: 2011-08-27
Posts: 3
Posted: Sat, 2011-08-27 23:41

Perfect!

Worked like a charm! Thank you very much!

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 21807
Posted: Sun, 2011-08-28 02:17

Dayo,
Thanks for your continued support to the community!

Dave
____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments
Dayo

Joined: 2005-11-04
Posts: 1132
Posted: Mon, 2011-08-29 19:09

Thanks to you Dave for for hard work here.

To the OP, the code above just deactivates enough of the module to give you access but since you do not have the module files present, nothing would come up in the G2 admin to fully remove the plugin from your database etc.

To achieve this, run the updated code below which is equivalent to clicking "delete" in the G2 Admin.

/* Prep */
$pluginType = 'module';
$pluginId = 'recaptcha';
$platform =& $gallery->getPlatform();
$ds = $platform->getDirectorySeparator();


/* Deactivate Module */
$ret = GalleryCoreApi::unregisterToolkitsByModuleId($pluginId);
$ret = GalleryCoreApi::unregisterFactoryImplementationsByModuleId($pluginId);
$ret = GalleryCoreApi::updateMapEntry('GalleryPluginMap', array('pluginType' => $pluginType, 'pluginId' => $pluginId), array('active' => 0));
GalleryDataCache::remove("GalleryPluginHelper::fetchPluginStatus($pluginType)");
GalleryDataCache::removeFromDisk(array('type' => $pluginType, 'itemId' => 'GalleryPluginHelper_fetchPluginStatus', 'id' => '_all'));
GalleryDataCache::remove("GalleryPluginHelper::fetchPluginList($pluginType)");
$event = GalleryCoreApi::newEvent('Gallery::DeactivatePlugin');
$event->setData(array('pluginType' => $pluginType, 'pluginId' => $pluginId));
list ($ret) = GalleryCoreApi::postEvent($event);


/* Uninstall Module */
$ret = GalleryCoreApi::unregisterModulePermissions($pluginId);
$ret = GalleryCoreApi::removeOnLoadHandlers(array());
$ret = GalleryCoreApi::removePlugin($pluginType, $pluginId);
$dataDir = $gallery->getConfig('data.gallery.plugins_data').$pluginType.'s'.$ds.$pluginId;
if ($platform->is_dir($dataDir)) {
	$platform->recursiveRmdir($dataDir);
}
$ret = GalleryCoreApi::removeTranslationsForPlugin($pluginType, $pluginId);
GalleryDataCache::remove("GalleryPluginHelper::fetchPluginStatus($pluginType)");
GalleryDataCache::removeFromDisk(array('type' => $pluginType, 'itemId' => 'GalleryPluginHelper_fetchPluginStatus', 'id' => '_all'));
GalleryDataCache::remove("GalleryPluginHelper::fetchPluginList($pluginType)");
$event = GalleryCoreApi::newEvent('Gallery::UninstallPlugin');
$event->setData(array('pluginType' => $pluginType, 'pluginId' => $pluginId));
list ($ret) = GalleryCoreApi::postEvent($event);


/* Delete Module */
$dataDir = GalleryCoreApi::getCodeBasePath($ds.$pluginType.'s'.$ds.$pluginId);
if ($platform->is_dir($dataDir)) {
	$platform->recursiveRmdir($dataDir);
}
$ret = GalleryCoreApi::removeMapEntry('GalleryPluginPackageMap', array('pluginType' => $pluginType, 'pluginId' => $pluginId));

--
dakanji.com

Login or register to post comments
The_Judge

Joined: 2011-08-27
Posts: 3
Posted: Mon, 2011-08-29 21:00

Great thanks to you , too ! :)

Login or register to post comments