Автоматично обновяване на 10 WordPress блога за 10 секунди

Идеята е, че трябва да се обновят 10 блога на WordPress и то бързичко с идеята при следващ ъпдейт да става лесно.
Понеже системата е писана на php реших и скриптчет ода бъде на php . Ето го и него:

<?php
#############################################
$wordpress_root_dirs=array(
"/var/www/sait1.com/",
"/var/www/sait2.com/",
"/var/www/sait3.com/",
"/var/www/sait4.com/",
"/var/www/sait5.com/",
"/var/www/sait6.com/",
"/var/www/sait7.com/",
"/var/www/sait8.com/",
"/var/www/sait9.com/",
"/var/www/sait10.com/"
);

$BDIR="/tmp/backup_upgraded_wordpress";
$NDIR="$BDIR/latest_wordpress_files";

#############################################

function dhs_lr_str($a,$b,$c){$a=explode("$a",$c);$b=explode("$b",$a[1]);return addslashes(trim($b[0]));};
$count_wp_blogs=count($wordpress_root_dirs)-1;

@system("mkdir -p $NDIR");
chdir("$NDIR");

echo "
###########################################################################
######## Mass Wordpress Updater ver. 0.1 by amri -- www.mpetrov.net ########
###########################################################################
\n";

echo "Downloading Latest WordPress … \n";
system("wget -q http://wordpress.org/latest.zip -O $NDIR/latest.zip");
system("unzip -o -q $NDIR/latest.zip");

$count_upd_wp=0;
foreach ($wordpress_root_dirs as $RDIR)
{
$count_upd_wp++;
echo "Update Wordpress blogs $count_upd_wp/$count_wp_blogs\n";

$buf=file_get_contents("$RDIR/wp-config.php");

$DB_NAME=trim(dhs_lr_str("define('DB_NAME', '","'",$buf));
$DB_USER=trim(dhs_lr_str("define('DB_USER', '","'",$buf));
$DB_PASSWORD=trim(dhs_lr_str("define('DB_PASSWORD', '","'",$buf));
$DB_HOST=trim(dhs_lr_str("define('DB_HOST', '","'",$buf));
$DB_TABLE=trim(dhs_lr_str('$table_prefix  = \","'",$buf));
$WDIR="$BDIR/$DB_NAME";

@system("mkdir -p $WDIR");
chdir("$WDIR");

echo "Backup Old WordPress ($RDIR) DB: $DB_NAME\n";
system("mysqldump -u$DB_USER -p$DB_PASSWORD $DB_NAME > $WDIR/$DB_NAME.sql");

echo "Backup Old WordPress ($RDIR) Files\n";
system("cp -Rp $RDIR/ $WDIR/wordress_files/");

echo "Replace Old WordPress($RDIR) Files\n";
system("cp -ar $NDIR/wordpress/* $RDIR/");

mysql_connect($DB_HOST,$DB_USER,$DB_PASSWORD);mysql_select_db($DB_NAME);
$result = mysql_query("select option_value from ".$DB_TABLE."options where option_name='siteurl'");
$row = mysql_fetch_array($result);
$siteurl=stripslashes($row['option_value']);

$ch1=curl_init();
curl_setopt($ch1,CURLOPT_URL,"$siteurl/wp-admin/upgrade.php?step=1&backto=");
curl_setopt($ch1,CURLOPT_RETURNTRANSFER,1);
$buf=curl_exec($ch1);
curl_close($ch1);
};
?>

Изходът е ето това:

###########################################################################
######## Mass WordPress Updater ver. 0.1 by amri -- www.mpetrov.net ########
###########################################################################

Downloading Latest WordPress …
Update WordPress blogs 1/12
Backup Old WordPress (/var/www/sait1.com/) DB: sait1DB
Backup Old WordPress (/var/www/sait1.com/) Files
Replace Old WordPress(/var/www/sait1.com/) Files
Update WordPress blogs 2/12
Backup Old WordPress (/var/www/sait2.com/) DB: sait2DB
Backup Old WordPress (/var/www/sait2.com/) Files
Replace Old WordPress(/var/www/sait2.com/) Files
Update WordPress blogs 3/12
Backup Old WordPress (/var/www/sait3.com/) DB: sait3DB
Backup Old WordPress (/var/www/sait3.com/) Files
Replace Old WordPress(/var/www/sait3.com/) Files
….

Може да го изтеглите от тук: wordpress_mass_upgrade

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Автоматично обновяване на 10 WordPress блога за 10 секунди, 5.0 out of 5 based on 1 rating

3 thoughts on “Автоматично обновяване на 10 WordPress блога за 10 секунди”

  1. G-N petrov izvinqvam se parvo 4e pi6a na latinica a 2-ro iskam da pomolq za ne6to imam nqkolko interesni vaprosa :) i bih se radval mnogo da mi otdelite malko vreme da mi sadeistvate blagodarq mnogo predvaritelno eto i skype ako re6ite da mi otgovorite mister_zmit

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  2. Може ли да направиш урок как да подкараме Blacktrack 5 на Windows 7

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)
  3. Niakoi shte mi kaje li kak da instaliram toia back track 4 za da moga da razbivam paroli. iskam da go probvam ama toia back track nemoga da go instaliram ta ako moje niakoi da mi kaje kak,po podrobni4ko. Mersi predvaritelno

    VA:F [1.9.22_1171]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Вашият коментар

Вашият email адрес няма да бъде публикуван Задължителните полета са отбелязани с *