[ php-blog-Patches-2992837 ] some issues with installing/upgrading shared install
"SourceForge.net" <[email protected]> Wed, 28 Apr 2010 08:01:06 +0000
| Newsgroups | gmane.comp.serendipity.trackers |
|---|---|
| Message-ID | <[email protected]> |
Patches item #2992837, was opened at 2010-04-27 11:53
Message generated for change (Comment added) made by jmroth
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=542824&aid=2992837&group_id=75065
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: J.M. Roth (jmroth)
Assigned to: Nobody/Anonymous (nobody)
Summary: some issues with installing/upgrading shared install
Initial Comment:
I would like to share a few patches to several issues I encountered while experimenting.
1) integrity check does not look nice on shared install => disable (for now)
<patch>
--- a/include/admin/installer.inc.php
+++ b/include/admin/installer.inc.php
@@ -95,6 +95,7 @@
<?php $errorCount = 0 ?>
<div align="center">
+<?php if (!defined('S9Y_DATA_PATH')) { // multisite ?>
<table class="serendipity_admin_list_item serendipity_admin_list_item_even" width="90%" align="center">
<tr>
<td colspan="2" style="font-weight: bold"><?php echo INTEGRITY ?></td>
@@ -120,6 +121,7 @@
</tr>
<?php } ?>
</table>
+<?php } // (!defined('S9Y_DATA_PATH')) ?>
<table class="serendipity_admin_list_item serendipity_admin_list_item_even" width="90%" align="center">
<tr>
<td colspan="2" style="font-weight: bold"><?php echo PHP_INSTALLATION ?></td>
</patch>
2) If an upgrade is indeed required, the link does not lead to the correct site but to the main site
<patch>
--- a/serendipity_config.inc.php
+++ b/serendipity_config.inc.php
@@ -379,7 +379,7 @@
return 1;
}
- serendipity_die(sprintf(SERENDIPITY_NEEDS_UPGRADE, $serendipity['versionInstalled'], $serendipity['version'], $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php'));
+ serendipity_die(sprintf(SERENDIPITY_NEEDS_UPGRADE, $serendipity['versionInstalled'], $serendipity['version'], dirname($_SERVER['PHP_SELF']) . '/serendipity_admin.php'));
}
// We don't care who tells us what to do
</patch>
3) Wrong path/link is shown on several other occasions.
Also, disable checksum checks again, since it does not really work here.
(please ignore the first mod which sets static $showAbort)
<patch>
--- a/include/admin/upgrader.inc.php
+++ b/include/admin/upgrader.inc.php
@@ -45,10 +45,11 @@
// codebase to only allow upgrading, no bypassing and thus causing instabilities.
// This variable can also be set as $serendipity['UpgraderShowAbort'] inside serendipity_config_local.inc.php to prevent
// your setting being changed when updating serendipity in first place.
-$showAbort = (isset($serendipity['UpgraderShowAbort']) ? $serendipity['UpgraderShowAbort'] : true);
+$showAbort = false;
-$abortLoc = $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[action]=ignore';
-$upgradeLoc = $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php?serendipity[action]=upgrade';
+$s9yhttppath= (defined('S9Y_DATA_PATH') ? dirname($_SERVER['PHP_SELF']).'/' : $serendipity['serendipityHTTPPath']);
+$abortLoc = $s9yhttppath . 'serendipity_admin.php?serendipity[action]=ignore';
+$upgradeLoc = $s9yhttppath . 'serendipity_admin.php?serendipity[action]=upgrade';
/* Functions which needs to be run if installed version is equal or lower */
$tasks = array(array('version' => '0.5.1',
@@ -239,6 +240,7 @@
$serendipity['dbPersistent'],
$privateVariables
);
+ if ($r!==TRUE) var_dump('ERROR!!!', $r);
if ($serendipity['GET']['action'] == 'ignore') {
echo SERENDIPITY_UPGRADER_YOU_HAVE_IGNORED;
@@ -246,7 +248,7 @@
printf('<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . SERENDIPITY_UPGRADER_NOW_UPGRADED .'</div>', $serendipity['version']);
}
echo '<br />';
- printf('<div align="center">'. SERENDIPITY_UPGRADER_RETURN_HERE .'</div>', '<a href="'. $serendipity['serendipityHTTPPath'] .'">', '</a>');
+ printf('<div align="center">'. SERENDIPITY_UPGRADER_RETURN_HERE .'</div>', '<a href="'. $s9yhttppath .'">', '</a>');
$_SESSION['serendipityAuthedUser'] = false;
@session_destroy();
} else {
@@ -260,11 +262,18 @@
<?php
$errorCount = 0;
$showWritableNote = false;
- $basedir = $serendipity['serendipityPath'];
+ if (defined('S9Y_DATA_PATH')) {
+ // Shared installation. S9Y_INCLUDE_PATH points to repository,
+ // S9Y_DATA_PATH points to the local directory.
+ $basedir = S9Y_DATA_PATH;
+ } else {
+ // Usual installation within DOCUMENT_ROOT.
+ $basedir = $serendipity['serendipityPath'];
+ }
?>
<div align="center">
<table class="serendipity_admin_list_item serendipity_admin_list_item_even" width="90%" align="center">
-<?php if (is_readable($basedir . 'checksums.inc.php')) {
+<?php if (is_readable($basedir . 'checksums.inc.php') && !defined('S9Y_DATA_PATH')) {
$badsums = serendipity_verifyFTPChecksums();
?>
<tr>
</patch>
4) Updating the site config file does not work at all on upgrade (also see above where we have added a reaction to $r = serendipity_updateLocalConfig() failing
<patch>
--- a/include/functions_installer.inc.php
+++ b/include/functions_installer.inc.php
@@ -71,7 +71,7 @@
umask(0000);
$file = 'serendipity_config_local.inc.php';
- $path = $serendipity['serendipityPath'];
+ $path = (defined('S9Y_DATA_PATH') ? dirname($_SERVER['SCRIPT_FILENAME']).'/' : $serendipity['serendipityPath']);
$oldconfig = @file_get_contents($path . $file);
$configfp = fopen($path . $file, 'w');
</patch>
----------------------------------------------------------------------
>Comment By: J.M. Roth (jmroth)
Date: 2010-04-28 10:01
Message:
Hmm alright that is indeed good to know, however I have it working like
that right now. So you say that one can either:
- have a serendipity_config_local.inc.php in /usr/share/serendipity (or
wherever the installation files have been extracted to),
- have a serendipity_config_local.inc.php in all the copies of the
deployment directory but then NOT in /usr/share/serendipity.
Why is that? (Since, as I said, that seems to be working too)
The problem I had previously was that the database contained wrong data
and I see that stuff like serendipityHTTPPath and serendipityPath is stored
in there and not computed at runtime... (my mistake)
(Relaxing the checksum warnings on shared installs might still be worth
looking into though)
----------------------------------------------------------------------
Comment By: Garvin Hicking (garvinhicking)
Date: 2010-04-27 14:56
Message:
Hi!
On a shared installation, the /usr/share/... path is NEVER one that is
activated! It always only holds the sourcecode.
ALL installations are shared installations, only those are allowed to have
a serendipity_config_local.inc.php file. This file may NEVER be present in
the target "data" directory.
Maybe this lightens up a few things?
----------------------------------------------------------------------
Comment By: J.M. Roth (jmroth)
Date: 2010-04-27 13:49
Message:
Oh before digging into the code, please give me another day to inspect my
setup again. This seems to be too wrong to be true. Thanks...
----------------------------------------------------------------------
Comment By: J.M. Roth (jmroth)
Date: 2010-04-27 12:08
Message:
Actually, I just noticed this doesn't seem to be enough.
If my second install is in /var/www/test/s9y (URL domain.com/test/s9y) and
the main install is in /usr/share/serendipity (URL /serendipity), then
S9Y_INCLUDE_PATH, and therefore $serendipity['serendipityPath'] too is
always set to /usr/share/... :-\
Can someone enlighten me?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=542824&aid=2992837&group_id=75065
------------------------------------------------------------------------------