[ php-blog-Patches-2992837 ] some issues with installing/upgrading shared install

"SourceForge.net" <[email protected]> Tue, 27 Apr 2010 09:53:36 +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 (Tracker Item Submitted) 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>

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=542824&aid=2992837&group_id=75065

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