CMS MADE SIMPLE FORGE

Site Pusher

 

[#4286] Created config.php file has double URL for uploads and image_uploads

avatar
Created By: Lew Shepherdson (lew)
Date Submitted: Sat Nov 07 23:38:10 -0500 2009

Assigned To: Robert Campbell (calguy1000)
Version: None
CMSMS Version: None
Severity: Major
Resolution: None
State: Open
Summary:
Created config.php file has double URL for uploads and image_uploads
Detailed Description:
Puzzled that this hasn't been reported or mentioned in the forum anywhere (at
least that I could find), since the cloned site wouldn't actually work at all...
(?)

Problem is in SitePusher.module.php ... create_new_config function:

line 217   $config['uploads_url'] = $weburl . '/uploads';
line 219   $config['image_uploads_url'] = $weburl .'/uploads/images';

They prepend the host part of the url ($weburl) to create a full (and accurate)
URL.  However, when the config.php file is written out by the core
'cms_config_text' function -- that function has lines (@ 260 and 318) like

\$config['uploads_url'] = \$config['root_url'] . '{$config['uploads_url']}';
\$config['image_uploads_url'] = \$config['root_url'] .
'{$config['image_uploads_url']}';

that also prepend the root URL to the value passed.  Thus the created config.php
ends up with

$config['uploads_url'] = $config['root_url'] . 'http://www.newhost.com/uploads'
;

and the value becomes

  http://www.newhost.comhttp://www.newhost.com/uploads'

(same for the 'image_uploads_url' value)

The patch file for the fix is:

Index: SitePusher.module.php
===================================================================
--- SitePusher.module.php	(revision 13)
+++ SitePusher.module.php	(working copy)
@@ -214,9 +214,9 @@
     $config['root_path'] = $serverpath;
     $config['preview_path'] = $serverpath.'/tmp/cache';
     $config['uploads_path'] = $serverpath.'/uploads';
-    $config['uploads_url'] = $weburl.'/uploads';
+    $config['uploads_url'] = '/uploads';
     $config['image_uploads_path'] = $serverpath.'/uploads/images';
-    $config['image_uploads_url'] = $weburl.'/uploads/images';
+    $config['image_uploads_url'] = '/uploads/images';
 
     $fh = fopen($destfile,'w');
     if( $fh )


Easy to fix on the target host ... and SitePusher worked great!  Godsend for
those of us who manage sites where we have no access to run mysqldump to copy
the database... Thanks!!

Lew


History