cvs: doc-editor /install doc-editor.sql /php class.php /scripts/cron check_build.php

From: Date: Sat, 16 May 2009 20:38:41 +0000
Subject: cvs: doc-editor /install doc-editor.sql /php class.php /scripts/cron check_build.php
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-4025@lists.php.net to get a copy of this message
yannick Sat May 16 20:38:41 2009 UTC Added files: /doc-editor/scripts/cron check_build.php Modified files: /doc-editor/install doc-editor.sql /doc-editor/php class.php Log: - Add check_build script. This script is actually activated on my local server. An email will be send on Thursday to warn when a documentation is broken. http://cvs.php.net/viewvc.cgi/doc-editor/install/doc-editor.sql?r1=1.6&r2=1.7&diff_format=u Index: doc-editor/install/doc-editor.sql diff -u doc-editor/install/doc-editor.sql:1.6 doc-editor/install/doc-editor.sql:1.7 --- doc-editor/install/doc-editor.sql:1.6 Sat Apr 25 08:38:44 2009 +++ doc-editor/install/doc-editor.sql Sat May 16 20:38:41 2009 @@ -170,3 +170,17 @@ last_connect datetime NOT NULL, KEY userID (userID) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; + +-- -------------------------------------------------------- + +-- +-- Structure of table buildLog +-- +CREATE TABLE IF NOT EXISTS buildLog ( + id int(10) unsigned NOT NULL AUTO_INCREMENT, + project varchar(50) NOT NULL, + lang varchar(10) NOT NULL, + status enum('0','1') NOT NULL, + date datetime NOT NULL, + PRIMARY KEY (id) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; \ No newline at end of file http://cvs.php.net/viewvc.cgi/doc-editor/php/class.php?r1=1.45&r2=1.46&diff_format=u Index: doc-editor/php/class.php diff -u doc-editor/php/class.php:1.45 doc-editor/php/class.php:1.46 --- doc-editor/php/class.php:1.45 Mon Apr 27 05:09:57 2009 +++ doc-editor/php/class.php Sat May 16 20:38:41 2009 @@ -2486,5 +2486,20 @@ } + /** + * Save buildLog status. + * + * @param $lang The lang checked + * @param $status The status of the build. 0 if the build is broken, 1 otherwise. + */ + function buildLog($lang, $status) + { + + $s = sprintf('INSERT INTO buildLog (project, lang, status, date) VALUES ("php","%s", "%s", now())', $lang, $status); + $this->db->query($s) or die('Error: '.$this->db->error.'|'.$s); + + return; + + } } // End of class http://cvs.php.net/viewvc.cgi/doc-editor/scripts/cron/check_build.php?view=markup&rev=1.1 Index: doc-editor/scripts/cron/check_build.php +++ doc-editor/scripts/cron/check_build.php <?php /*** * This script is intended to be placed in a cronjob. * It must be run every Thursday, at 01hOO for example. * On Unix, you can use crontab -e and place this : * 00 01 * * 4 /usr/bin/php /path/to/your/cvs/dir/doc-editor/scripts/cron/check_build.php ****/ require_once dirname(__FILE__) . '/../../php/class.php'; $phpDoc = new phpDoc(); // For all language, we check the build while (list(, $lang) = each($phpDoc->availableLanguage)) { $cmd = 'cd '.dirname(__FILE__).'/../'.DOC_EDITOR_CVS_PATH.';/usr/bin/php configure.php --with-lang='.$lang.' --disable-segfault-error'; $output = array(); exec($cmd, $output); $msg = implode("\n", $output); $msg = "Your documentation is broken. The build is done on Friday.\n\nPlease, try to fix it *quickly*.\n\nHere is the output of the configure.php script :\n\n=============================\n\n".$msg; $smg .= " -- This email is send automatically by the PhpDocumentation Online Editor. "; $status = 1; // Send an email only if the build is broken if( !strstr($msg, 'All good. Saving .manual.xml... done.')) { $status = 0; $to = "doc-$lang@lists.php.net"; $subject = "[DOC-".strtoupper($lang)."] - Your documentation is broken"; $headers = 'From: www@php.net' . "\r\n" . 'X-Mailer: PhpDocumentation Online Editor' . "\r\n" . 'Content-Type: text/plain; charset="utf-8"'."\n"; mail("yannick.torres@keliglia.com", $subject, $msg, $headers); } $phpDoc->buildLog($lang, $status); } ?>

« previous php.doc.cvs (#4025) next »