/**
  * @static
  * @return RepositoryFetcher
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
 public function clearLocalChangeByModifiedID($modifiedID)
 {
     $rf = RepositoryFetcher::getInstance();
     // We retrieve modifiedID information
     $fileInfo = $rf->getModifiesById($modifiedID);
     $fileInfo = $fileInfo[0];
     // If we are on root node, $fileInfo['path'] is empty. He must be "/".
     if ($fileInfo['path'] == '') {
         $fileInfo['path'] = '/';
     }
     $info = $this->clearLocalChange($fileInfo['type'], new File($fileInfo['lang'], $fileInfo['path'] . $fileInfo['name']));
     return $info;
 }
<?php

/***
* This script is intended to be placed in a cronjob.
* It must be run every Monday, at 08hOO for example.
* On Unix, you can use crontab -e and place this :
* 00 08 * * 1 /path/php/binary /path/to/your/vcs/dir/doc-editor/scripts/cron/send_work_to_list.php
****/
require_once dirname(__FILE__) . '/../../php/Conf.php';
require_once dirname(__FILE__) . '/../../php/AccountManager.php';
require_once dirname(__FILE__) . '/../../php/LogManager.php';
require_once dirname(__FILE__) . '/../../php/ProjectManager.php';
require_once dirname(__FILE__) . '/../../php/RepositoryFetcher.php';
require_once dirname(__FILE__) . '/../../php/RepositoryManager.php';
$rf = RepositoryFetcher::getInstance();
$rm = RepositoryManager::getInstance();
$pm = ProjectManager::getInstance();
$availableProject = $pm->getAvailableProject();
while (list($key, $project) = each($availableProject)) {
    // Actually, only PHP project support to be automatically checked for the build. Skip all others projects
    if ($project['code'] != "php") {
        continue;
    }
    echo "enter into " . $project['code'] . "\n";
    // We must delete this var to be re-generated
    unset($rm->existingLanguage);
    // Define it as a project
    $pm->setProject($project['code']);
    $existingLanguage = $rm->getExistingLanguage();
    // For all language, we check the build
    foreach ($existingLanguage as $lang) {
 /**
  * 
  */
 public function getDirectActionData()
 {
     $am = AccountManager::getInstance();
     if (!$am->isLogged()) {
         return JsonResponseBuilder::failure();
     }
     $rf = RepositoryFetcher::getInstance();
     $action = $this->getRequestVariable('action');
     $idDB = $this->getRequestVariable('idDB');
     $fileInfo = $rf->getModifiesById($idDB);
     $fileInfo = $fileInfo[0];
     // We get the diff
     $file = new File($fileInfo['lang'], $fileInfo['path'] . $fileInfo['name']);
     return JsonResponseBuilder::success(array('fileInfo' => $fileInfo, 'userInfo' => $am->getUserDetailsByID($fileInfo['userID']), 'vcsDiff' => DiffGenHTMLOutput($file->diff())));
 }
 private function getKarmaList()
 {
     if (!$this->karmaList) {
         // If this data is older than 1 day, we update it
         $data = RepositoryFetcher::getStaticValue('karma_list', '');
         if ($data === false || $data->update_time + 24 * 60 * 60 > time()) {
             $this->updateKarmaList();
             $data = RepositoryFetcher::getStaticValue('karma_list', '');
         }
         $this->karmaList = $data->data;
     }
     return $this->karmaList;
 }
Example #6
0
// Perm link management
if (isset($_REQUEST['perm'])) {
    $perm = trim($_REQUEST['perm'], '/ ');
    if (substr($perm, -4) == '.php') {
        require_once dirname(__FILE__) . '/php/ProjectManager.php';
        require_once dirname(__FILE__) . '/php/RepositoryFetcher.php';
        $_project = $_REQUEST['project'];
        // Set the project
        ProjectManager::getInstance()->setProject($_project);
        $_p = explode('/', $perm);
        $_lang = array_shift($_p);
        $_file = array_pop($_p);
        $_id = explode('.', $_file);
        array_pop($_id);
        $xmlid = implode('.', $_id);
        $r = RepositoryFetcher::getInstance()->getFileByXmlID($_lang, $xmlid);
        if ($r) {
            $jsVar = "\n" . 'var directAccess = {"link":"perm", "lang":"' . $r->lang . '", "path":"' . $r->path . '", "name":"' . $r->name . '", "project":"' . $_project . '"},';
        } else {
            $jsVar = "\n" . 'var directAccess = false,';
        }
    } else {
        $jsVar = "\n" . 'var directAccess = false,';
    }
} else {
    if (isset($_REQUEST['patch'])) {
        $patch = trim($_REQUEST['patch'], '/ ');
        $_project = $_REQUEST['project'];
        require_once dirname(__FILE__) . '/php/ProjectManager.php';
        // Set the project
        ProjectManager::getInstance()->setProject($_project);