forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: ron4mac on March 31, 2017, 10:34:08 pm

Title: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on March 31, 2017, 10:34:08 pm
For currently running CPG 1.5.20+ installations, an assistive script to use for upgrading to a release version of CPG 1.6 was made available here (http://forum.coppermine-gallery.net/index.php/topic,78505.msg381584.html#msg381584).

Attached to this post is a script that can be used to upgrade a CPG 1.5.32+ installation that has suddenly stopped working because of PHP changes (for example) at your site. Place the script file (as cpg_installer_stub.php) in the root of your CPG installation. Access the script as <your_coppermine_url>/cpg_installer_stub.php. Choose to upgrade your current installation.
Be very aware: you could be using a plugin or theme that is not compatible with CPG 1.6

This same script can also be used to create a new installation of CPG 1.6 (or update an existing one with the latest changes).   Make sure you have a database user and password already configured on your server.  Load the script to an appropriate place on your server (where you want the installation to be).  Access the script from a web browser and perform the installation.

Update: v3.3 better notification of file placement errors
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: netb on June 21, 2017, 10:44:23 pm
Hello,

I kind of missed that post and did a normal upgrade by downloading the 1.6.03 github source, then overwriting the 1.5 cpg and starting the update.php. Should I be concerned or look for something not quite right? At first glance the script seems to download the latest github files as well.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on June 21, 2017, 11:57:30 pm
You're good either way. The script was just to make it easier for some people.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dale M. on July 14, 2017, 11:23:39 pm
Tried to do "fix" by using "cpg_installer_stub.php" and all i got was a error:

Releases of CPG not found at Github

What do I do now?

Dale


Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on July 15, 2017, 03:32:13 am
It would seem that your server is not configured in a way that will allow the method to work for you.

Your options are:
Get your hosting provider to backoff PHP7 long enough for you use the "upgrader.php" method. (other thread)

Get your hosting provider to turn on "allow_url_fopen" for your currently running PHP7. Then use the "cpg_installer_stub.php" method.

Use "manual" method to perform the upgrade. http://documentation.coppermine-gallery.net/en/upgrading.htm
Title: Re: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dale M. on July 15, 2017, 03:27:50 pm
It would seem that your server is not configured in a way that will allow the method to work for you.

Your options are:
Get your hosting provider to backoff PHP7 long enough for you use the "upgrader.php" method. (other thread)

Get your hosting provider to turn on "allow_url_fopen" for your currently running PHP7. Then use the "cpg_installer_stub.php" method.

Use "manual" method to perform the upgrade. http://documentation.coppermine-gallery.net/en/upgrading.htm

IF I use "manual" method for up grade, it takes me to version 1.5.46, Correct?... Does that get me past the  mysql(i)  and php7 problem or is it just another layer of work and problem will still persist?

IF "manual" method as describes in link works for 1.6.X what is proper download file to do upgrade and do same instruction apply?

Dale
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on July 15, 2017, 03:50:20 pm
Use the 1.6.03 version here: https://github.com/coppermine-gallery/cpg1.6.x/releases

Follow the same method as for 1.5.  You MUST run <your-cpg-site>/update.php after uploading all the files.
Title: Re: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dale M. on July 15, 2017, 06:48:39 pm
Use the 1.6.03 version here: https://github.com/coppermine-gallery/cpg1.6.x/releases

Follow the same method as for 1.5.  You MUST run <your-cpg-site>/update.php after uploading all the files.

Thank you... The adventure continues... Keeping fingers crossed....

Dale M.
Title: Re: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dale M. on July 15, 2017, 09:45:09 pm
Thank you... The adventure continues... Keeping fingers crossed....

Dale M.

Ok.... I can see  Coppemine and navigate through all the images, BUT can not log in as "admin"... Get this error message:

This page isn’t working

mariposamuseum.com is currently unable to handle this request.

HTTP ERROR 500


Going to search forum for possible answers... It's getting better, but not quite "there" yet...

Dale
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on July 15, 2017, 09:57:46 pm
Did you run "update.php"?
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dale M. on July 15, 2017, 10:05:49 pm
YES for second time, may have entered "update.php" incorrectly in URL first time around and did not any error message...

Everything seems good now.. Keeping fingers crossed!

Thank you the guidance and patience..

Cheers!

Dale M.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: DKogan on November 17, 2017, 11:04:39 pm
Thanks for the suggestion....I'll wait for the "stable" release. I understand its a beta release but my users might not understand. :)
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on November 18, 2017, 05:58:24 am
Thanks for the suggestion....I'll wait for the "stable" release. I understand its a beta release but my users might not understand. :)
To think that CPG 1.6.03 is not stable would be wrong thinking. It has only not been fully released due to lacking updates for the documentation. Your users may also not understand your gallery being down because your hosting provider changed server software ... something that v1.6.x is ready for. Ultimately though ... your choice.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: mikeandm on December 29, 2017, 05:56:31 pm
Hello - Apologies for what must be a truly dumb question but I can't get cpg_installer_stub.php to run beyond its start screen. With the Install location selected as "Upgrade..." and Available Install Packages selected as "CPG Developer Release 1.6.03", pressing "Install Selected Package" just produces a popup message "Please select the package to install". This happens (repeatedly) on Microsoft Edge and Internet Explorer. The radio button for the selection shows correctly. I'm not aware of any unusual settings in the browsers. Any ideas on what can be going wrong? Many thanks in advance...
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: mikeandm on December 29, 2017, 06:29:07 pm
Yes - seems it was a daft question and the answer appears to be "Use Firefox!" (or presumably other browsers). Still clueless as to why Edge and IE don't play... Anyway, script now run successfully - very many thanks!
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on December 29, 2017, 07:03:47 pm
Still clueless as to why Edge and IE don't play...
Added an updated script (above) for IE compatibility.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dankriss on February 08, 2018, 12:11:30 pm
I just used this as SourceForge is down at the moment... or is for me... WOW so much easier to do a new install...


Only problem I had because I am thick is to not upload the .txt document but make a new one!  doh!


Thanks


Kriss :)
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: anglefire on March 11, 2018, 04:58:34 pm
I've run this script on  my 1.5.20 install - and it says everything is installed and the option to complete install is displayed.

But running that and I get this error:

Fatal error: Uncaught Error: Call to undefined function cpg_db__fetch_assoc() in /var/www/disco3club/public_html/gallery/bridge/phpbb3.inc.php:167 Stack trace: #0 /var/www/disco3club/public_html/gallery/bridge/udb_base.inc.php(168): cpg_udb->get_groups(Array) #1 /var/www/disco3club/public_html/gallery/bridge/udb_base.inc.php(89): core_udb->load_user_data(Array) #2 /var/www/disco3club/public_html/gallery/include/init.inc.php(257): core_udb->authenticate() #3 /var/www/disco3club/public_html/gallery/update.php(26): include_once('/var/www/disco3...') #4 {main} thrown in /var/www/disco3club/public_html/gallery/bridge/phpbb3.inc.php on line 167

Any ideas?

Mark
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on March 11, 2018, 05:14:21 pm
Run the installer script again but choose the bottom (red) version to install. You'll pick up a change that corrects this (along with some other bug fixes).

But also please note that the recommended version to upgrade from in this way was mentioned as 1.5.32+.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: anglefire on March 11, 2018, 05:27:41 pm
Thanks - that has helped - the only issue I have now is that my coppermine admin account details are not what I thought they were!
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on March 11, 2018, 05:34:24 pm
You may not have run update.php (it should have run automatically)
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: anglefire on March 11, 2018, 06:25:19 pm
I'm at that point now - and the admin account I use on the old version (I've just checked on the old server) doesn't work - its asking for authentication but the user I have for admin (Not the one in the image here) isn't working.

Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on March 11, 2018, 06:34:37 pm
Part of the issue with trying this with a version < 1.5.32.

You'll have to mess with that database in this way:
http://forum.coppermine-gallery.net/index.php/topic,79099.msg383519.html#msg383519
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: anglefire on March 11, 2018, 07:09:54 pm
Thanks again,


Finally sorted it - though do i Have to unbridge it to be able to change the admin password?
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on March 11, 2018, 07:20:55 pm
Finally sorted it - though do i Have to unbridge it to be able to change the admin password?

Yes.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: anglefire on March 11, 2018, 07:26:46 pm
Thanks - I actually read something after I posted this and it is sorted

Have a tipple of something on me :)
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: FrA1l3 on March 13, 2018, 04:48:55 pm
thank you for this script. It saves me a lot of time  ;) :)
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: desidia on November 13, 2018, 04:07:47 pm
heyho!

is there any way to update from coppermine Version 1.1 with this Upgrade?
My Hoster has also did an update to PHP 7.2 and doesn't support my running CM version 1.1... :-\

Thanks! :)

Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: desidia on November 13, 2018, 04:13:51 pm
heyho!

is there any way to update from coppermine Version 1.1 with this Upgrade?
My Hoster has also did an update to PHP 7.2 and doesn't support my running CM version 1.1... :-\

Thanks! :)

where's the edit Button? :-\

I've looked twice, and I've the coppermine Version 1.4.25 !
could I Update to Version 1.6.x without problems? :)
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on November 13, 2018, 04:17:56 pm
I've looked twice, and I've the coppermine Version 1.4.25 !
could I Update to Version 1.6.x without problems? :)
You will need to be on CPG 1.5.x first.
http://documentation.coppermine-gallery.net/en/upgrading.htm#upgrade_14
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: desidia on November 13, 2018, 04:27:37 pm
thanks for the link! I've readed a little bit, but I didn't found a quick answer: Does 1.5.x support PHP 7 too?
Because my Hoster doesn't support any PHP <7...

So I can't upgrade to CM 1.5 if it doesn't work onto PHP7... :-\ (no execution of PHP5 Scripts)
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on November 13, 2018, 04:34:15 pm
Does 1.5.x support PHP 7 too?
No.

You could ask your hoster to make PHP 5 available to you for a while. They should be able to do that.

If not, you will have to do a new install and try to recover your images as best you can.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: desidia on November 15, 2018, 11:03:21 am
I've talked to my Hoster. They couldn't setup for me a version <PHP7.

Now I've got a second Idea. I'll upload all content to my test webspace (xampp on my own device) which works with PHP5.
I'll export the SQL-Database from webspace, but I don't know the password... I can reset this password to a new value -> download the SQL-Database via phpmyadmin and import them to my test webspace into a new database.

but the problem is: how could I  change the password into the testsetup to the new one? the frontend has the old password and couldn't connect to database with new password...
How could I fix this?
If this works, I could Update to 1.5.x and than to 1.6.x and after that I could export Database (and data) to normal webspace and it should work...?

But another problem seems to be here; I've customized the frontend to my needed options. I lost this with upgrade? :-\
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: desidia on November 15, 2018, 11:07:24 am
ah, I'm a dump idiot!

I'll see all infos at /include/config.inc.php

Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Αndré on January 13, 2019, 10:27:40 pm
heyho!

is there any way to update from coppermine Version 1.1 with this Upgrade?
My Hoster has also did an update to PHP 7.2 and doesn't support my running CM version 1.1... :-\

Thanks! :)

Double post: http://forum.coppermine-gallery.net/index.php/topic,79533.0.html >:(
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: VLK on January 22, 2019, 12:34:10 pm
Hi,

After update my gallery ( http://www.valonkuvaaja.com/kuvagalleria/ ) is blank when I use php 7.2, php 5.6 gallery works fine. Where is problem?
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on January 22, 2019, 04:51:28 pm
After update my gallery is blank when I use php 7.2, php 5.6 gallery works fine. Where is problem?

You are using a plugin that is incompatible with CPG 1.6.x. In your plugins folder, rename all the folders that don't start with upload_ to something like X_<current-name>. Unless there is also an incompatibility with the theme you are using, that should allow you to see your gallery. Login and make sure to run <your-gallery-url>/update.php. Then you can rename one plugin at a time back to normal to see which ones are causing any problems.
Title: Re: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: VLK on January 22, 2019, 05:58:46 pm
You are using a plugin that is incompatible with CPG 1.6.x. In your plugins folder, rename all the folders that don't start with upload_ to something like X_<current-name>. Unless there is also an incompatibility with the theme you are using, that should allow you to see your gallery. Login and make sure to run <your-gallery-url>/update.php. Then you can rename one plugin at a time back to normal to see which ones are causing any problems.

Thanks for help :D, final_extract plugin cause that problem.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: VLK on January 22, 2019, 06:41:38 pm
When I'am login everything works fine, but when I'am not random and album pics not open.

For example

http://www.valonkuvaaja.com/kuvagalleria/thumbnails.php?album=28

Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on January 22, 2019, 07:38:26 pm
When I'am login everything works fine, but when I'am not random and album pics not open.

It is being caused by your theme.
http://www.valonkuvaaja.com/kuvagalleria/thumbnails.php?album=28&theme=curve

Look in your theme.php file and change any mysql_xxx_xxx to cpg_db_xxx_xxx.
Title: Re: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: VLK on January 28, 2019, 09:53:39 pm
It is being caused by your theme.
http://www.valonkuvaaja.com/kuvagalleria/thumbnails.php?album=28&theme=curve

Look in your theme.php file and change any mysql_xxx_xxx to cpg_db_xxx_xxx.

Thank you very much  :D
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dutch_Master on May 11, 2019, 03:11:55 pm
Regret to report the script isn't working for me.

Script is located at the <web-root>/coppermine/ directory and made executable (chmod +x cpg_installer_stub.php)
Page shows in the webbrowser and I can select the bullet-points I want, but no progress beyond this. Server runs a fully functioning pbpBB3 board (3.2.7 on php7). Apache2 is restarted several times.
Both script and the above /coppermine directory are owned by the same user that owns the phpBB3 directory. Using standard Firefox-esr from Devuan ASCII repo.

Advise is much appreciated. TIA!
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on May 11, 2019, 03:26:35 pm
What happens when you click this button?

Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dutch_Master on May 11, 2019, 03:28:10 pm
It's not there, I'm afraid. (screen-shot possible, if needed)
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on May 11, 2019, 03:33:46 pm
Can you provide a link to your site or PM me with a link to it?
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dutch_Master on May 11, 2019, 03:37:35 pm
Can't edit messages (or haven't found the button yet!)
This is the contents of the script I have:
Code: [Select]
cat cpg_installer_stub.php
Code: [Select]

<?php
/**
 * Coppermine Photo Gallery
 *
 * v1.0 originally written by Gregory Demar
 *
 * @copyright  Copyright (c) 2003-2019 Coppermine Dev Team
 * @license    GNU General Public License version 3 or later; see LICENSE
 *
 * cpg_installer_stub.php (v3.2)
 * @since  1.6.06
 */
error_reporting(-1);
define('UPDATER_LOG''installer.log.txt');

// ================================================== //
// to be added appropriately to the language file(s)
$lang_install_php['no_zip_extn'] = 'The extension providing ZipArchive is not available';
$lang_install_php['delete_log'] = 'Please first delete the log file: <code>'.UPDATER_LOG.'</code>';
$lang_install_php['files_placed_title'] = 'Package files placed';
$lang_install_php['files_placed_msg'] = 'All package files were successfully placed. Click below to complete the install.';
$lang_install_php['complete_install'] = 'Complete Install';
$lang_install_php['select_install'] = 'Please select the package to install.';
$lang_install_php['available_packages'] = 'Available Install Packages';
$lang_install_php['not_writeable'] = '<b>Installation can not be performed</b><br />The following directories are not writeable: ';
$lang_install_php['perform_install'] = 'Install Selected Package';
$lang_install_php['no_installs_title'] = 'No install available';
$lang_install_php['no_installs_msg'] = 'No packages are currently available for you to install';
$lang_install_php['not_possible'] = 'The server is not configured to allow this method to function.<br />PHP needs allow_url_fopen or cURL enabled.';
$lang_install_php['not_found'] = 'Releases of CPG not found at Github';
$lang_install_php['save_error'] = 'Could not save package file. Operation aborted.';
$lang_install_php['pre_warning'] = '<span style="color:red">WARNING: This is a pre-release version!</span>';
$lang_install_php['location'] = 'Install location:';
$lang_install_php['loc_curdir'] = 'New install in the current directory';
$lang_install_php['loc_separate'] = 'New install in a separate directory';
$lang_install_php['upgrade_current'] = 'Upgrade/update the current CPG installation';
// ================================================== //

if (file_exists(UPDATER_LOG)) die($lang_install_php['delete_log']);

if (!
extension_loaded('zip')) {
die($lang_install_php['no_zip_extn']);
}

echo <<<EOT
<!DOCTYPE html>
<html>
<head>
<title>Coppermine Photo Gallery Installer Stub</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style type="text/css">
input, button, label {cursor: pointer}
button { font-size: 1em }
div.contain { padding: 4em; }
.shead { font-size: 1.2em; font-weight: bold; }
.tableb { background-color: #EEE; }
td.bleed { background-color: #F77; color: #FFB; }
.iloc { margin-bottom: 1em; }
.updt { border-collapse: collapse; margin-bottom: 1em; }
.iloc input, .updt input { margin-left: 1em; margin-right: .5em; }
.oblk:hover { background-color: #EFE }
div.cpg_message_info { background-color: #E8FFE8; border: 1px solid #3C3; border-radius: 4px; padding: 1em; margin-bottom: 1em; }
span.cpg_message_info { }
</style>
</head>
<body>
<div class="contain">
EOT;

$updater = new CPG_Updater();
if (isset(
$_POST['doinst'])) {
$indir = ($_POST['inLoc'] == 's') ? 'cpg16x/' '';
$updater->performUpdate($_POST['updid'], $indir);
$pstrun = ($_POST['inLoc'] == 'u') ? 'update.php' 'install.php';
msg_box($lang_install_php['files_placed_title'], $lang_install_php['files_placed_msg'], 'cpg_message_info'$lang_install_php['complete_install'], $pstrun);
echo <<<EOT
<a href="{$indir}{$pstrun}"><button>{$lang_install_php['complete_install']}</button></a>
EOT;
} else {

echo <<<EOT
<script type="text/javascript">
function hasUpdSelect(frm)
{
if (!$("input[name='updid']:checked").val()) {
alert('
{$lang_install_php['select_install']}');
return false;
}
$('#doinst').hide();
$('#upding').show();
return true;
}
</script>
EOT;

$updates $updater->getUpdates();
//echo'<pre>';var_dump($updates);echo'</pre>';
if ($updates) {
$badDirs $updater->checkCpgDirs();
if ($badDirs) {
$bdmsg implode(','$badDirs);
msg_box('',$lang_install_php['not_writeable'].$bdmsg'cpg_message_error''''');
}
echo '<form id="updForm" action="" method="post" onsubmit="return hasUpdSelect(this);">';
$baseURL $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']);
$dirURL $baseURL '/cpg16x';
$urad '';
$cChk 'checked ';
if (file_exists('include/config.inc.php')) {
include 'include/config.inc.php';
}
if (!empty($CONFIG['TABLE_PREFIX'])) {
$urad '<input type="radio" name="inLoc" id="inLoc0" value="u" checked /><label for="inLoc0">'.$lang_install_php['upgrade_current'].'</label><br/>';
$cChk '';
}
echo <<<EOT
<div class="iloc">
<span class="shead">
{$lang_install_php['location']}</span><br />
{$urad}
<input type="radio" name="inLoc" id="inLoc1" value="c" 
{$cChk}/><label for="inLoc1">{$lang_install_php['loc_curdir']}</label> ({$baseURL})<br/>
<input type="radio" name="inLoc" id="inLoc2" value="s" /><label for="inLoc2">
{$lang_install_php['loc_separate']}</label> ({$dirURL})
</div>
EOT;
echo '<table class="updt">';
echo '<tr><td colspan="2" class="lhead shead">'.$lang_install_php['available_packages'].'</td></tr>';
foreach ($updates as $k => $updt) {
$xmsg '';
if ($updt['pre']) { $xmsg .= '<br />'.$lang_install_php['pre_warning']; }
$tclass $k%'tableb_alternate' 'tableb';
echo <<<EOT
<tr class="oblk {$tclass}">
<td><input type="radio" name="updid" value="
{$updt['id']}" id="t{$updt['id']}" /></td>
<td><label for="t
{$updt['id']}"><p><b>{$updt['name']}</b>{$xmsg}<br />{$updt['body']}</p></label></td>
</tr>

EOT;
}
echo '<tr class="oblk"><td class="bleed">';
echo '<input type="radio" name="updid" value="-1" id="bldv" />';
echo '</td><td class="bleed">';
echo '<label for="bldv"><p>Get the very latest package (unreleased) with all current developer changes.<br />Recommended only for special circumstances.</p></label>';
echo '</td></tr></table>';
if (!$badDirs) echo '<button type="submit" name="doinst" id="doinst" class="admin">'.$lang_install_php['perform_install'].'</button>';
echo '<img id="upding" width="16" height="16" alt="" src="data:image/gif;base64,R0lGODlhEAAQAPIAANHX3AAAAJ+kqDY3OQAAAFBSVGpucHh7fiH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAEAAQAAADMwi63P4wyklrE2MIOggZnAdOmGYJRbExwroUmcG2LmDEwnHQLVsYOd2mBzkYDAdKa+dIAAAh+QQJCgAAACwAAAAAEAAQAAADNAi63P5OjCEgG4QMu7DmikRxQlFUYDEZIGBMRVsaqHwctXXf7WEYB4Ag1xjihkMZsiUkKhIAIfkECQoAAAAsAAAAABAAEAAAAzYIujIjK8pByJDMlFYvBoVjHA70GU7xSUJhmKtwHPAKzLO9HMaoKwJZ7Rf8AYPDDzKpZBqfvwQAIfkECQoAAAAsAAAAABAAEAAAAzMIumIlK8oyhpHsnFZfhYumCYUhDAQxRIdhHBGqRoKw0R8DYlJd8z0fMDgsGo/IpHI5TAAAIfkECQoAAAAsAAAAABAAEAAAAzIIunInK0rnZBTwGPNMgQwmdsNgXGJUlIWEuR5oWUIpz8pAEAMe6TwfwyYsGo/IpFKSAAAh+QQJCgAAACwAAAAAEAAQAAADMwi6IMKQORfjdOe82p4wGccc4CEuQradylesojEMBgsUc2G7sDX3lQGBMLAJibufbSlKAAAh+QQJCgAAACwAAAAAEAAQAAADMgi63P7wCRHZnFVdmgHu2nFwlWCI3WGc3TSWhUFGxTAUkGCbtgENBMJAEJsxgMLWzpEAACH5BAkKAAAALAAAAAAQABAAAAMyCLrc/jDKSatlQtScKdceCAjDII7HcQ4EMTCpyrCuUBjCYRgHVtqlAiB1YhiCnlsRkAAAOwAAAAAAAAAAAA==" style="display:none" />';
echo '</form>';
} else {
msg_box($lang_install_php['no_installs_title'], $lang_install_php['no_installs_msg'], 'cpg_message_warning''''');
}
}
echo <<<EOT
</div>
</body>
</html>
EOT;

function 
msg_box ($title$message$class$button=''$link='')
{
echo <<<EOT
<div class={$class}><span class={$class}>{$message}</span></div>
EOT;
}

class 
CPG_Updater
{
protected $updates = array();

public function __construct ()
{
global $lang_install_php;

$urld $this->getUrlData('https://api.github.com:443/repos/coppermine-gallery/cpg1.6.x/releases');
$releases json_decode($urld);
if (!$releases) {
die($lang_install_php['not_found']);
}
foreach ($releases as $r) {
// if ($r->prerelease) continue; // don't offer any prereleases
$tag $r->tag_name;
if (preg_match('/\d+\.\d+\.\d+/'$tag$m)) {
$this->updates[] = array(
'id' => $r->id,
'tag' => $m[0],
'pre' => $r->prerelease,
'ball' => $r->zipball_url,
'tball' => $r->tarball_url,
'name' => $r->name,
'body' => nl2br($r->body)
);
}
}
}

public function getUpdates ()
{
return $this->updates;
}

public function performUpdate ($id$inDir='')
{
global $lang_install_php;

$updt null;
if ($id 0) {
$updt = array('tag'=>'v1.6.devlop''ball'=>'https://github.com/coppermine-gallery/cpg1.6.x/archive/develop.zip');
} else foreach ($this->updates as $u) {
if ($u['id'] == $id) {
$updt $u;
break;
}
}

if (!$updt) return;

@unlink(UPDATER_LOG);
$this->logIt("GETTING: {$updt['tag']}");
$tmpf = (sys_get_temp_dir() ?: 'albums/edit').'/cpg_upd_'.time().'.zip';
$newUpdate $this->getUrlData($updt['ball']);
$dlHandler fopen($tmpf'w');
if (!fwrite($dlHandler$newUpdate)) { die($lang_install_php['save_error']); }
fclose($dlHandler);

$f2p = array('anycontent.php'); //files to preserve if they already exist
$p2s = array(); //paths to skip (whether they exist or not)
$zip = new ZipArchive;
$res $zip->open($tmpf);
if ($res === TRUE) {
if ($inDir) {
@mkdir($inDir);
$this->logIt("DIR: {$inDir}");
}
for ($i 0$i $zip->numFiles$i++ ) {
$stat $zip->statIndex($i);
list($bd,$fp) = explode('/'$stat['name'], 2);
if (substr($fp, -1) == '/') {
if ($this->matchedPath($fp$p2s)) continue;
$fp $inDir $fp;
if (!is_dir($fp)) @mkdir($fp);
$this->logIt("DIR: {$fp}");
} elseif ($fp) {
if (in_array($fp$f2p) && file_exists($fp)) continue;
if ($this->matchedPath($fp$p2s)) continue;
$fc $zip->getFromIndex($i);
$fp $inDir $fp;
file_put_contents($fp$fc);
$this->logIt("PUT: {$fp}");
}
}
$zip->close();
} else {
echo 'failed, code:' $res;
}

unlink($tmpf);
}

public function checkCpgDirs ()
{
$cpgDirs = array('.');
$ng = array();
foreach ($cpgDirs as $dir) {
if (!(is_dir($dir) && is_writable($dir))) $ng[] = $dir;
}
return $ng;
}

private function getUrlData ($url)
{
$ua 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14';
if (ini_get('allow_url_fopen')) {
ini_set('user_agent'$ua);
$rfc file_get_contents($url); //var_dump(get_headers($url),$http_response_header);
if (!$rfc) return $this->curly($url$ua);
return $rfc;
} else {
return $this->curly($url$ua);
}
}

private function curly ($url$agent)
{
if (!function_exists('curl_init')) die($lang_install_php['not_possible']);
// create curl resource
$ch curl_init();
// set url
curl_setopt($chCURLOPT_URL$url);
//return the transfer as a string
curl_setopt($chCURLOPT_RETURNTRANSFER1);
curl_setopt($chCURLOPT_USERAGENT$agent);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($chCURLOPT_FOLLOWLOCATION1);
// $output contains the output string
$output curl_exec($ch);
// close curl resource to free up system resources
curl_close($ch);
// return the data
return $output;
}

private function matchedPath ($file$paths)
{
foreach ($paths as $p) {
$p str_replace('/','\/',$p);
if (preg_match("/^{$p}/"$file)) return true;
}
return false;
}

private function logIt ($msg)
{
file_put_contents(UPDATER_LOG"{$msg}\n"FILE_APPEND);
}

}
//EOF
I'm attempting a clean install of cpg 1.6.06.

The server is on my local LAN (not accessible from the web) as a testbed for future deployment of my forum (which is online but not involved as such). It does have full web access by itself.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on May 11, 2019, 03:46:16 pm
The only reason the 'install' button would not show is if the directory is not writeable by your web server (but I thought you should get some message about that). The coppermine directory should be owned by www-data (or whatever your web server group is).
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dutch_Master on May 11, 2019, 03:49:17 pm
Right. I'll change that (the ownership) right-away.

Below the screenshot, I blacked-out some things for privacy reasons, but the full page is shown (no scroll-bars).
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: Dutch_Master on May 11, 2019, 03:52:20 pm
Right, now I do have the install button! Changing ownership of the coppermine directory to www-data solved the problem. Thanks so much!
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: MTapester on May 24, 2019, 03:46:53 am
Hi,

Trying to upgrade from 1.5.42 to the latest

I tossed the upgrader & cpg_installer_stub on the server  and both seem to come up with this Parse error: syntax error, unexpected ':' in /home/content/06/6372506/html/cpg15x/upgrader.php on line 167

looking at that line and it seems to be the same for both.

$tmpf = (sys_get_temp_dir() ?: 'albums/edit').'/cpg_upd_'.time().'.zip';

Anyone run into this before?
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on May 24, 2019, 04:35:23 am
You'll need PHP 5.3 or later.
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: MTapester on May 26, 2019, 01:23:27 am
The server is currently running 5.6
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: MTapester on May 26, 2019, 02:18:11 am
Never mind...I jump the gun and 5.6 wasn't active yet....it works now. Sorry and thanks for the help
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ninouee on September 13, 2019, 11:09:11 am
Hello

I'm in 1.5.46 (stable)on ma gallery http://ddstv.fr/galerie/index.php


And when i try to upgrade with "cpg_installer_stub.php" i have this message "No packages are currently available for you to install".

Can you tell me what can i do to fix this?

Thank you
Title: Re: CPG 1.6 (PHP7) Upgrade/Install Aid
Post by: ron4mac on September 13, 2019, 02:20:55 pm
And when i try to upgrade with "cpg_installer_stub.php" i have this message "No packages are currently available for you to install".
Can you tell me what can i do to fix this?
Your host/site must allow access to remote url data or have the curl extension available for use.  If neither of these can be made available, you will have to update manually (https://coppermine-gallery.net/docs/curr/en/upgrading.htm).