Contenido

Actualiza automáticamente WordPress 2.1

10 feb

+ 4

Fantástico script que te tendrá actualizado automáticamente a la nueva versión de WordPress 2.1.

#!/usr/bin/php
< ?php
/* Get info from the WordPress repository regarding trunk. We will use this to parse out the latest revision number */
$svninfo = shell_exec('svn info /root/working_copies/wptrunk/trunk/');
$lines = explode("n", $svninfo);
$bits = explode(' ', $lines[7]);
$oldrev = $bits[3];

/* I use shell_exec() because the output of the CLI commands will be returned. I'll be able to add this to the email */
$log = "PROCESS LOGn---------------nn";
$log .= shell_exec('svn up /root/working_copies/wptrunk/trunk/');
$log .= shell_exec('svn export --force /root/working_copies/wptrunk/trunk /home/techno/public_html/');

/* Get the revision number of the working copy. This is the new revision number */
$svninfo = shell_exec('svn info /root/working_copies/wptrunk/trunk/');
$lines = explode("n", $svninfo);
$bits = explode(' ', $lines[7]);
$newrev = $bits[3];

/* Pass the revision info along to be included in the email */
$details = "nnOld Revision: $oldrevnNew Revision: $newrevnnn";

/* Use the revision numbers to determine the log of changes between them. Add for email.  */
$history = "SVN LOGn---------------nn";
$history .= shell_exec("svn log -r $oldrev:$newrev /root/working_copies/wptrunk/trunk/");
$history .= "nn";

/* Grab detailed changes (diff) between revisions. Add to email. */
$history .= "SVN DIFFn---------------nn";
$history .= shell_exec("svn diff -r $oldrev:$newrev http://svn.automattic.com/wordpress/trunk/");
$history .= "nn";

/* Put the pieces together for the email, then send */
$message = $details . $history . $log;
mail('TU@MAIL.COM','WordPress SVN Update', $message, 'From: TU@MAIL.com');
?>

Este script se encarga de enviarnos un mail con la información recogida acerca de la actualización. Cambia el TU@MAIL.COM por el mail al que quieras enviar el resultado de la actualización.

Old Revision: 4863
New Revision: 4871

SVN LOG
---------------

------------------------------------------------------------------------
r4863 | ryan | 2007-02-02 11:38:26 -0500 (Fri, 02 Feb 2007) | 1 line

Check page ID only if is_page.  fixes #3049
------------------------------------------------------------------------
r4865 | ryan | 2007-02-02 19:56:23 -0500 (Fri, 02 Feb 2007) | 1 line

Typo fix from charleshooper.  fixes #3743
------------------------------------------------------------------------
r4866 | ryan | 2007-02-05 16:29:39 -0500 (Mon, 05 Feb 2007) | 1 line

Disambiguate queries.  Props mhyk25.  fixes #3747
------------------------------------------------------------------------
r4867 | ryan | 2007-02-05 16:37:47 -0500 (Mon, 05 Feb 2007) | 1 line

Make DB_COLLATE blank by default so that MySQL will choose the default collation for the charset. #3517
------------------------------------------------------------------------
r4870 | ryan | 2007-02-05 20:44:23 -0500 (Mon, 05 Feb 2007) | 1 line

XMLRPC changes from Joseph.
------------------------------------------------------------------------
r4871 | ryan | 2007-02-06 15:12:53 -0500 (Tue, 06 Feb 2007) | 1 line

Send content type header. Props nbachiyski.  fixes #3754
------------------------------------------------------------------------

SVN DIFF
---------------

Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 4863)
+++ wp-includes/query.php	(revision 4871)
@@ -794,16 +794,16 @@
 			$in_cats = substr($in_cats, 0, -2);
 			$out_cats = substr($out_cats, 0, -2);
 			if ( strlen($in_cats) > 0 )
-				$in_cats = " AND category_id IN ($in_cats)";
+				$in_cats = " AND $wpdb->post2cat.category_id IN ($in_cats)";
 			if ( strlen($out_cats) > 0 ) {
-				$ids = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id IN ($out_cats)");
+				$ids = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE $wpdb->post2cat.category_id IN ($out_cats)");
 				if ( is_array($ids) && count($ids > 0) ) {
 					foreach ( $ids as $id )
 						$out_posts .= "$id, ";
 					$out_posts = substr($out_posts, 0, -2);
 				}
 				if ( strlen($out_posts) > 0 )
-					$out_cats = " AND ID NOT IN ($out_posts)";
+					$out_cats = " AND $wpdb->posts.ID NOT IN ($out_posts)";
 				else
 					$out_cats = '';
 			}
Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 4863)
+++ wp-includes/functions.php	(revision 4871)
@@ -329,7 +329,7 @@

 	$alloptions = wp_load_alloptions();
 	if ( isset($alloptions[$option_name]) ) {
-		$alloptions[$options_name] = $newvalue;
+		$alloptions[$option_name] = $newvalue;
 		wp_cache_set('alloptions', $alloptions, 'options');
 	} else {
 		wp_cache_set($option_name, $newvalue, 'options');
Index: xmlrpc.php
===================================================================
--- xmlrpc.php	(revision 4863)
+++ xmlrpc.php	(revision 4871)
@@ -228,7 +228,7 @@
 				"wp_page_parent_title"	=> $parent_title,
 				"wp_page_order"			=> $page->menu_order,
 				"wp_author_id"			=> $author->ID,
-				"wp_author_display_username"	=> $author->display_name
+				"wp_author_display_name"	=> $author->display_name
 			);

 			return($page_struct);
Index: wp-config-sample.php
===================================================================
--- wp-config-sample.php	(revision 4863)
+++ wp-config-sample.php	(revision 4871)
@@ -5,7 +5,7 @@
 define('DB_PASSWORD', 'password'); // ...and password
 define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
 define('DB_CHARSET', 'utf8');
-define('DB_COLLATE', 'utf8_general_ci');
+define('DB_COLLATE', '');

 // You can have multiple installations in one database if you give each a unique prefix
 $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
Index: wp-admin/index-extra.php
===================================================================
--- wp-admin/index-extra.php	(revision 4863)
+++ wp-admin/index-extra.php	(revision 4871)
@@ -2,6 +2,8 @@
 require_once('admin.php');
 require_once (ABSPATH . WPINC . '/rss.php');

+@header('Content-type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
+
 switch ( $_GET['jax'] ) {

 case 'incominglinks' :

PROCESS LOG
---------------

U  /root/working_copies/wptrunk/trunk/wp-includes/query.php
U  /root/working_copies/wptrunk/trunk/wp-includes/functions.php
U  /root/working_copies/wptrunk/trunk/xmlrpc.php
U  /root/working_copies/wptrunk/trunk/wp-config-sample.php
U  /root/working_copies/wptrunk/trunk/wp-admin/index-extra.php

Fetching external item into '/root/working_copies/wptrunk/trunk/wp-content/plugins/akismet'
Updated external to revision 7886.

Updated to revision 4871.
Export complete.

 

Requiere PHP 4.0.1 o superior,  shell_exec(), SVN y Crontab.

Comentar

#

Me reservo el derecho de eliminar y/o modificar los comentarios que contengan lenguaje inapropiado, spam u otras conductas no apropiadas en una comunidad civilizada. Si tu comentario no aparece, puede ser que akismet lo haya capturado, cada día lo reviso y lo coloco en su lugar. Siento las molestias.