Files
web-doc-editor/scripts/cron/update_data.php
T
Yannick Torres e232ed22e7 New :
* upgrade extJs to 3.2.1
* Remove "Pending commit" module in favore to "work in progress" module
* Remove "Pending patch" module in favore to "patches for review" module
* Add a field to ask for an email when we logging in. It allow users to contact others.
* Add a progress bar to allow user indicate the progression of his work
* Anonymous user are no longer "anonymous", as a cookie is set on connexion to "authenticate" him.
* Anonymous user can save a file as an authenticated user. No longer only use the "patch" button.
* New rules when a file is edited. When the file is edited by :

  - an anonymous user : authenticated user can always edit it. When he does, the owner change and anonymous user can't edit it again.

  - an authenticated user : anonymous and others authenticated users can't edit it. The first user must release it (eithers commit his change, or remove the change he does). Administrator can edit it. This can allow to override change made by an authenticated user. Administrators are defined per project in configuration file.

* We no longer allow a user to commit files changed by others users. An authenticated user can only commit his files.

Bugs :

  - fix bug #51767
  - fix bug that display internal file (.new) in some modules
  - change file() class beaviours
2010-05-24 20:04:32 +00:00

94 lines
2.3 KiB
PHP

<?php
/***
* This script is intended to be placed in a cronjob.
* It must be run every day, at 00hOO for example.
* On Unix, you can use crontab -e and place this :
* 00 00 * * * /path/php/binary /path/to/your/vcs/dir/doc-editor/scripts/cron/update_data.php
****/
require_once dirname(__FILE__) . '/../../php/Conf.php';
require_once dirname(__FILE__) . '/../../php/ProjectManager.php';
require_once dirname(__FILE__) . '/../../php/RepositoryManager.php';
require_once dirname(__FILE__) . '/../../php/TranslationStatistic.php';
require_once dirname(__FILE__) . '/../../php/TranslatorStatistic.php';
$isCLI = (PHP_SAPI == 'cli');
if ($isCLI) {
echo "\nPHP Documentation Online Editor - Update data\n\n";
}
$rm = RepositoryManager::getInstance();
$pm = ProjectManager::getInstance();
$availableProject = $pm->getAvailableProject();
while( list($key, $project) = each($availableProject) ) {
// We must delete this var to be re-generated
unset($rm->existingLanguage);
// Define it as a project
$pm->setProject($project['code']);
if ($isCLI) {
echo "\n * Update the VCS repository for the " . $project['name'] . "...";
}
flush();
// VCS update
//$rm->updateRepository();
if ($isCLI) {
echo "\n * Clean up the database...";
}
flush();
// Clean Up DB
$rm->cleanUp();
// Set the lock File
$lock = new LockFile('project_' . $project['code'] . '_lock_apply_tools');
if ($lock->lock()) {
if ($isCLI) {
echo "\n * Applying tools on repository...";
}
flush();
// Start Revcheck
$rm->applyRevCheck();
// Search for NotInEN Old Files
$rm->updateNotInEN();
if ($isCLI) {
echo "\n * Parsing translation data...";
}
flush();
// Parse translators
$rm->updateTranslatorInfo();
if ($isCLI) {
echo "\n * Compute all statistics...";
}
flush();
// Compute all summary
TranslationStatistic::getInstance()->computeSummary('all');
TranslatorStatistic::getInstance()->computeSummary('all');
// Store this info
$info = array();
$info['user'] = 'root';
$rm->setStaticValue('info', 'updateData', json_encode($info), true);
}
$lock->release();
}
if ($isCLI) {
echo "\n\nUpdate completed!\n";
}
?>