[SOLVED] Undefined variable: versions in module.inc on line 548 during upgrade process to 2.3

mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Wed, 2011-07-27 07:54

Gallery URL : tnis.uk.net
Gallery version: ? not sure as I cannot access the gallery whilst it is trying to upgrade itself ?
Apache version: ?
PHP version 4

Apologies if this is in the wrong forum but I am unable to determine which version of gallery we are running.
Yesterday our gallery decided to upgrade itself but the upgrade/index.php file had been hacked previously so I downloaded a copy of gallery 2.3 and uploaded the contents of the html folder to the live system.

Having spoken with our host, they advised that some of the paths have been hard coded so are incorrect and should be :

/home/71021/domains/tnis.uk.net/
rather than
/nfs/c05/h02/mnt/71021/domains/tnis.uk.net/

This is because their system automatically moves hosting accounts to alternative physical locations if they are using too much resource. I did a search and replace on the path in all files in the 'html' folder which worked and now, I can run the upgrade process and get to step 4 but then I get the following message at the top of the screen :

Notice: Undefined variable: versions in /nfs/c05/h02/mnt/71021/domains/tnis.uk.net/html/modules/core/module.inc on line 548

It seems like the full path still exists somewhere but I am unable to find it - please help!

Thanks

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Wed, 2011-07-27 08:28

in addition to the above - this is the debug output from the upgrade process :

file_exists(/home/71021/domains/tnis.uk.net/g2data_aab41b5203/versions.dat)
file(/home/71021/domains/tnis.uk.net/g2data_aab41b5203/versions.dat, )
Unknown module version 0.8 in prepareConfigUpgrade()
is_writeable(/nfs/c05/h02/mnt/71021/domains/tnis.uk.net/html/config.php)

--------------------------------------------------------
Upgrade Core Module
--------------------------------------------------------

--------------------------------------------------------
System and Gallery information:
--------------------------------------------------------
Gallery version: 2.0-alpha-3
File integrity: There are missing/modified files!
SVN install: No
PHP version: 4.4.9 cgi-fcgi
PHP memory limit: 99M
PHP disable_functions:
PHP zend.ze1_compatibility_mode:
Webserver: Apache/2.0.54
Database: mysqlt 5.1.55-rel12.6
Operating system: Linux n22 2.6.33.1mtv4 #1 SMP Fri Apr 8 10:06:54 PDT
2011 i686
Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101
Firefox/5.0
--------------------------------------------------------

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Wed, 2011-07-27 12:52
Quote:
Gallery version: 2.0-alpha-3

WOW!, thats an old version
if you can upgrade from there, you will have to do it incrementally.
2.0-alpha-3 -> 2.0 -> 2.1 -> 2.2.6 -> 2.3.1
backing up each step along the way.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Wed, 2011-07-27 13:08

Oh!!! :(

Thanks for the reply, although, when I try to download v2.0 I cannot find the files?
2.2.6 seems to be the earlist on the site?
could you suggest where I might find the older versions?

 
Dayo

Joined: 2005-11-04
Posts: 1555
Posted: Wed, 2011-07-27 15:52

Unfortunately, for reasons I don't fully know, you are correct that all versions of G2 earlier than 2.2.6 appear to have been wiped off the face of the earth. I thought SourceForge was there to saveguard stuff but perhaps something wnet wrong there.

You can try to upgrade to 2.2.6 directly.

Back everything up first.

--
dakanji.com

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Wed, 2011-07-27 17:05

Kevin has them for download here.
he may even have a version of 2.0 somewhere too.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 09:12

Thanks - much appreciated! :)

Although.. when I upload the 2.1 files and run the upgrade script I get the following (below) any ideas?

------------------------------------------------
Upgrading the Gallery Core Module

The Gallery Core Module is the heart of the Gallery application. You can upgrade most other modules using the Site Administration interface, but this module must be handled separately in order for the upgrade to go smoothly.
Currently installed 0.8
New version 1.1.0.2

Your upgrade cannot begin because some of your active modules/themes are incompatible or missing. You must either locate more recent versions of these modules or themes, or revert to your original version of Gallery. No changes have been made so it's safe to revert. If you have many incompatible modules listed below, it's possible that you downloaded a smaller distribution of Gallery than what you originally installed. You can download a larger distribution from the Gallery website.

Module digibug is incompatible
Module dynamicalbum is incompatible
Module ecard is incompatible
Module flashvideo is incompatible
Module httpauth is incompatible
Module itemadd is incompatible
Module jpegtran is incompatible
Module keyalbum is incompatible
Module notification is incompatible
Module replica is incompatible
Module snapgalaxy is incompatible

Download replacement modules from the Gallery website

------------------------------------------------

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 10:35

when you originally tried to update to 2.3 you uploaded those modules which won't work w/2.1
just remove them and try again.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 10:45

Do you mean I have to delete the relevant folder from within the 'modules' folder?
I tried this and I still get the same message.. :(

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 10:49

You removed them? or renamed them? Gallery will still see them if you renamed them.
Also if there are 2.1 versions of any of those modules to have them in place.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 10:52
 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 11:00

yeah, I deleted them so they are no longer there.. is it possible my gallery thinks it is a different version than it really is?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 11:04

if they are not there, gallery cannot complain about them.
delete everything in g2data/cache/module

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 11:43

OK, done that - now I get a slightly different set of messages saying the modules are missing rather than incompatible :

Module digibug is missing
Module dynamicalbum is missing
Module ecard is missing
Module flashvideo is missing
Module httpauth is missing
Module itemadd is missing
Module jpegtran is missing
Module keyalbum is missing
Module notification is missing
Module replica is missing
Module snapgalaxy is missing

Are these modules required? if not, any idea where they are referred to?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 11:56

they are not required, in fact they did not even exist back in the 2.1 era
I don't know where gallery is getting that info, must be cached somewhere.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 12:02

this may be a solution:

  • grab a copy of each of those missing modules from your copy of 2.3
  • edit each module's module.inc
  • changing the required APIs to:
    	$this->setRequiredCoreApi(array(7, 0));
    	$this->setRequiredModuleApi(array(3, 0));
    
  • upload to your gallery
  • upgrade making sure not to install those modules
  • when gallery is upgraded/working remove those modules
  • continue your upgrade path as normal

it may take a bit of work, but upgrading from an early alpha at this stage will be work any way you slice it.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 12:56

OK, having done this and retrying the upgrade I did manage to get a little further!

But.. you guessed it..

Quote:
An error occurred while upgrading Gallery Core Module

Look to me like I am missing database table g2_PermissionMap
Although I do have a table called g2_PermissionSetMap - not sure if this is the same??

stack trace
-------------------------------------------
Error (ERROR_STORAGE_FAILURE)

in modules/core/classes/GalleryStorage.class at line 476 (gallerycoreapi::error)
in modules/core/classes/Gallery.class at line 223 (mysqlstorage::search)
in modules/core/CoreModuleExtras.inc at line 548 (gallery::search)
in modules/core/module.inc at line 487 (coremoduleextras::upgrade)
in modules/core/classes/GalleryModule.class at line 157 (coremodule::upgrade)
in upgrade/steps/UpgradeCoreModuleStep.class at line 83 (coremodule::installorupgrade)
in upgrade/index.php at line 221 (upgradecoremodulestep::processrequest)
--------------------------------------------

and this is the bottom of the debug output

-------------------------------------------
1146: Table 'db71021_photo_browser.g2_PermissionMap' doesn't exist

adodb_mysqlt._execute(
SELECT
COUNT(DISTINCT g2_PermissionMap.g_itemId)
FROM
g2_PermissionMap
LIMIT 1, false) % line 855,
file: adodb.inc.php
adodb_mysqlt.execute(
SELECT
COUNT(DISTINCT g2_PermissionMap.g_itemId)
FROM
g2_PermissionMap
LIMIT 1, Array[0]) % line 479,
file: adodb-mysql.inc.php
adodb_mysqlt.selectlimit(
SELECT
COUNT(DISTINCT g2_PermissionMap.g_itemId)
FROM
g2_PermissionMap
, 1, -1, Array[0]) % line 465,
file: GalleryStorage.class
mysqlstorage.search(
SELECT
COUNT(DISTINCT [GalleryPermissionMap::itemId])
FROM
[GalleryPermissionMap]
, Array[0], Array[1]) % line 223,
file: Gallery.class
gallery.search(
SELECT
COUNT(DISTINCT [GalleryPermissionMap::itemId])
FROM
[GalleryPermissionMap]
, Array[0], Array[1]) % line 548,
file: CoreModuleExtras.inc

realpath(/nfs/c05/h02/mnt/71021/domains/tnis.uk.net/html/modules/core/classes/../../../)
Error: Failed to upgrade the core module, this is the error stack trace:
Error (ERROR_STORAGE_FAILURE)in
modules/core/classes/GalleryStorage.class at line 476
(gallerycoreapi::error)
in modules/core/classes/Gallery.class at line 223
(mysqlstorage::search)
in modules/core/CoreModuleExtras.inc at line 548
(gallery::search)
in modules/core/module.inc at line 487
(coremoduleextras::upgrade)
in modules/core/classes/GalleryModule.class at line 157
(coremodule::upgrade)
in upgrade/steps/UpgradeCoreModuleStep.class at line 83
(coremodule::installorupgrade)
in upgrade/index.php at line 221
(upgradecoremodulestep::processrequest)

realpath(/nfs/c05/h02/mnt/71021/domains/tnis.uk.net/html/modules/core/classes/../../../)
-------------------------------------------

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 13:07

Not the same.
See, this is where the missing 2.0 final may have created this table.
Lemme query Kevin and see if he has a 2.0 release.

You really should not have waited this long to upgrade.
Does your gallery have many images?
You can do an import into 2.3.1 via the serverAdd method.
You will keep the directory/Album structure but lose titles, descriptions, comments...

I'll have Kevin peek into this thread.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Thu, 2011-07-28 13:08

Gallery version: 2.0-alpha-3
File integrity: There are missing/modified files!

Did you really have such an old version of G2? The upgrader will throw that error if you're missing versions.dat (located in your g2data directory) or it can't read it. Gallery will also "decide to upgrade itself" if that same file gets deleted or becomes un-readable. I'm betting this is what happened.

Please tell us you made a backup before you started anything.
____________________________________________
Like Gallery? Like the support? Donate now!

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 13:19

Unfortunately, this gallery has been online for a fair while with a LOT of images on it (30 companies worth!)
I inherited this last year when I joined the company but the guy who implemented it is long gone.. believe me, this is just a needle in the haystack of problems I have encountered since!

This is the response from our host (Media Temple) when I asked for a backup to recover from :

Quote:
I have reviewed your account and found that unfortunately, the most recent backup done to your account was at 6:30 am PST today. Do to the size and volume of the (gs) Grid-Service we do not keep any other backups of the network. (mt) Media Temple roles the (gs) Grid-Service backups weekly for our own disaster recovery. It is recommended that you make regular backups via FTP and phpMyAdmin.

..not what I needed to hear!

So looks like I have no option but to proceed with your suggestions (of which I am hugely grateful of btw!)..

Should I try the 2.3.1 upgrade? Are there any other possibilities without losing the image titles? we rely on these as a reference to our offline database of print images!

Thanks again
mike

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 13:23

I'm really not sure which version the gallery was before - I was relying on the output from the upgrade script as guidance as I could not access it once the upgrade process had started.

I do have a versions.dat file in g2data_aab41b5203 but it is empty.. not sure if this is indicative of what may have happened?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 13:25

As nivekiam suggests is there a versions.dat in your g2data? what are the contents?

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 13:25

I did take a backup of the database before I attempted the upgrade and I do have a folder containing a backup of the original files, although I cannot say for certain if I downloaded it before or after attempting the upgrade..?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Thu, 2011-07-28 13:30

Man, I feel your pain.

Quote:
..not what I needed to hear!

But what you should be doing, on any system you ever admin over. Never rely on the hosts backups or their backup service alone.

That aside, if your versions.dat file is blank. We might be able to dig into the database to get this information. suprsidr or Dayo might get the info needed to look that up before I do, but you can try digging around in the DB somewhere in plugins for the core module, should be that info. I always have to pull up phpMyAdmin and browse the DB for that....
____________________________________________
Like Gallery? Like the support? Donate now!

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 13:35

Thanks nivekiam, I'll see if I can find that in phpMyAdmin..

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 13:40

in g2_PluginParameterMap I have :

module | core | 0 | _version | 1.3.0

is this what you needed?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 13:40

look to table g2_PluginPackageMap
pluginId: core
packageName: base
packageVersion: x.x.x.x
packageBuild: xxxxx

if you have that table.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 13:43

yes I have it :

module core base 1.3.0 18183 0

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 7892
Posted: Thu, 2011-07-28 13:43

looks like you are at version 2.3
change your versions.dat to read

1.3.0
2.3

and retry your upgrade to 2.3.1

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 13:45

oh cool, thanks suprsidr - I'll give it a whirl..!

 
mike.mardon

Joined: 2011-07-27
Posts: 16
Posted: Thu, 2011-07-28 15:19

nice one - it worked!

thanks again for all your help guys! :)

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16503
Posted: Thu, 2011-07-28 15:22

Now to get that backup strategy in place :)
____________________________________________
Like Gallery? Like the support? Donate now!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25961
Posted: Fri, 2011-07-29 04:07

Great support guys!

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team