Changeset 550 for trunk/plog-admin/_upgrade.php
- Timestamp:
- 06/30/08 13:45:19 (4 years ago)
- Location:
- trunk/plog-admin
- Files:
-
- 2 moved
-
. (moved) (moved from trunk/admin)
-
_upgrade.php (moved) (moved from trunk/_upgrade.php) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plog-admin/_upgrade.php
r509 r550 1 1 <?php 2 3 2 error_reporting(E_ERROR); 4 5 3 echo ' 6 4 <html> 7 5 <head> 8 6 <title>Upgrade Plogger</title> 9 <link rel="stylesheet" type="text/css" href=" admin/../css/admin.css">7 <link rel="stylesheet" type="text/css" href="css/admin.css"> 10 8 </head> 11 9 <body> 12 <img src=" graphics/plogger.gif" alt="Plogger">10 <img src="images/plogger.gif" alt="Plogger"> 13 11 <h1>Performing Upgrade...</h1>'; 14 12 15 13 // This is the upgrade file for upgrading your Plogger gallery from Beta 1 16 $workdir = getcwd();14 $workdir = dirname(dirname(__FILE__)); 17 15 if (file_exists($workdir.'/plog-connect.php')) 18 16 { … … 23 21 print $workdir . " is not writable, but I need to create a new file in it"; 24 22 exit; 25 } ;23 } 26 24 27 25 // now parse DB connection parameters out of plog-connect … … 50 48 if (!$fh) { 51 49 die("Could not write plog-config.php, please make the file writable and then try running this script again"); 52 } ;50 } 53 51 fwrite($fh,"<?php\n"); 54 52 fwrite($fh,$cfg_file); … … 57 55 58 56 unlink($workdir.'/plog-connect.php'); 59 print "Done!<br />";60 61 } ;57 print "Done!<br />"; 58 59 } 62 60 63 61 function makeDirs($strPath, $mode = 0777) //creates directory tree recursively … … 72 70 while($row = mysql_fetch_array($res,MYSQL_NUM)) { 73 71 if ($row[0] == $column) $found = true; 74 } ;72 } 75 73 if (!$found) { 76 74 print "<li>Adding new field $column to database."; … … 78 76 } else { 79 77 print "<li>$column already present in database."; 80 } ;78 } 81 79 } 82 80 … … 87 85 while($row = mysql_fetch_array($res,MYSQL_NUM)) { 88 86 if ($row[0] == $column) $found = true; 89 } ;87 } 90 88 if ($found) { 91 89 print "<li>dropping $column"; … … 94 92 } else { 95 93 //print "$column does not exist<br/>"; 96 } ;94 } 97 95 } 98 96 … … 106 104 } 107 105 108 include("plog-functions.php"); 109 include("plog-globals.php"); 110 include("plog-config.php"); 106 include($workdir."/plog-config.php"); 107 include($workdir."/plog-globals.php"); 108 include($workdir."/plog-includes/plog-functions.php"); 109 111 110 connect_db(); 112 111 $errors = ""; … … 195 194 $sql = "UPDATE $config_table SET gallery_url = '" . $config['baseurl'] . "'"; 196 195 mysql_query($sql); 197 } ;196 } 198 197 199 198 … … 255 254 256 255 // insert default value (default theme directory) 257 $default_theme_dir = dirname(__FILE__)."/ ". 'themes/default/';256 $default_theme_dir = dirname(__FILE__)."/plog-content/themes/default/""; 258 257 print "<li>Setting default theme directory to $default_theme_dir</li>"; 259 258 $sql = 'UPDATE '.TABLE_PREFIX.'config SET `theme_dir` = \''.$default_theme_dir.'\' WHERE 1'; … … 270 269 $sql = 'ALTER TABLE '.TABLE_PREFIX.'config 271 270 ADD (`small_lastmodified` datetime NOT NULL, 272 `large_lastmodified` datetime NOT NULL,273 `rss_lastmodified` datetime NOT NULL)';271 `large_lastmodified` datetime NOT NULL, 272 `rss_lastmodified` datetime NOT NULL)'; 274 273 275 274 if (mysql_query($sql)) … … 280 279 281 280 echo "</ul>"; 282 echo "<p>Reorganizing your imagesfolder...";281 echo "<p>Reorganizing your 'images/' folder..."; 283 282 284 283 # strip images prefix from pictures table … … 324 323 $filename = basename($row['path']); 325 324 $directory = $row['collection_path']."/".$row['album_path']."/"; 326 $new_path = " images/".$directory.$filename;325 $new_path = "plog-content/images/".$directory.$filename; 327 326 if ($row['path'] == $new_path) continue; 328 327 echo "<li>Moving $row[path] -> $new_path</li>"; 329 328 330 329 // move physical file, create directory if necessary and update path in database 331 if (!makeDirs(" images/".$directory, 0755))330 if (!makeDirs("plog-content/images/".$directory, 0755)) 332 331 echo "<ul><li>Error: Could not create directory $directory!</li></ul>"; 333 332 … … 347 346 echo "</ul>"; 348 347 349 if (!$errors) 348 if (!$errors) { 350 349 echo "Your files were successfully reorganized!"; 351 else 350 } else { 352 351 echo "There were $errors errors, check your permissions settings."; 352 } 353 353 354 354 … … 376 376 print "failed to convert $tablename to $charset<br/>"; 377 377 print mysql_error(); 378 } ;379 } 380 } ;381 382 echo "<p>Upgrade has completed! "378 } 379 } 380 } 381 382 echo "<p>Upgrade has completed!</p>" 383 383 ?> 384 385 386
Note: See TracChangeset
for help on using the changeset viewer.
