Ejemplo n.º 1
0
 static function migrate_one($db, $target)
 {
     error_log("Migration vers la version " . $target . ".");
     $class = 'Strass_Migrate_To' . $target;
     if (class_exists($class)) {
         $handler = new $class();
         $handler->run($db);
     } else {
         error_log("Pas de migration vers la version {$target}.");
         die;
     }
     Strass_Version::save($target);
 }
Ejemplo n.º 2
0
 function indexAction()
 {
     $this->metas(array('DC.Title' => 'Administration'));
     $this->actions->append("Paramètres du site", array('action' => 'parametres'));
     $this->view->indicateurs = $m = new Wtk_Table_Model('label', 'url', 'compteur', 'level');
     $config = Zend_Registry::get('config');
     $m->append('Version', null, Strass_Version::PROJET, array('version-produit', 'notice'));
     $m->append('Version des données', null, Strass_Version::dataCurrent(), array('version-data', strass_admin_count_level(Strass_Version::DATA - Strass_Version::dataCurrent(), 1, 1)));
     $m->append('Association', null, strtoupper($config->system->association), 'notice');
     $t = new Inscriptions();
     $count = $t->countRows();
     $m->append("Inscriptions à valider", $this->_helper->Url('valider', 'membres'), $count, strass_admin_count_level($count, 1, 5));
     $t = new Unites();
     $count = $t->countRows();
     $m->append("Unités", $this->_helper->Url('unites'), $count, strass_admin_count_level(0 - $count, 0, 0));
     $t = new Individus();
     $count = $t->countRows();
     $m->append("Fiches d'individu", $this->_helper->Url('index', 'individus'), $count, 'notice');
     $t = new Users();
     $count = $t->countRows();
     $m->append("Membres", $this->_helper->Url('index', 'individus', null, array('filtre' => 'membres')), $count, 'notice');
     $t = new Citation();
     $count = $t->countRows();
     $m->append("Citations", $this->_helper->Url('index', 'citation'), $count, 'notice');
     $this->view->log = $m = new Wtk_Table_Model('date', 'level', 'logger', 'label', 'url', 'prenom-nom', 'fiche', 'detail-url');
     $t = new Logs();
     $events = $t->fetchAll($t->select()->order('date DESC')->limit(20));
     foreach ($events as $e) {
         $url = $this->_helper->Url('event', null, null, array('id' => $e->id));
         $u = $e->findParentUsers();
         if ($u) {
             $i = $u->findParentIndividus();
             $pn = $i->getFullname();
             $fiche = $this->_helper->Url('fiche', 'individus', null, array('individu' => $i->slug));
         } else {
             $pn = 'Visiteur';
             $fiche = null;
         }
         $m->append($e->date, strtolower($e->level), $e->logger, $e->message, $e->url, $pn, $fiche, $url);
     }
     $this->view->connexions = $m = new Wtk_Table_Model('date', 'prenom-nom', 'fiche');
     $t = new Users();
     $users = $t->fetchAll($t->select()->where('last_login')->order('last_login DESC')->limit(8));
     foreach ($users as $u) {
         $i = $u->findParentIndividus();
         $m->append($u->last_login, $i->getFullname(false, false), $this->_helper->Url('fiche', 'individus', null, array('individu' => $i->slug)));
     }
 }
Ejemplo n.º 3
0
 function initDb()
 {
     /* optimisation car la création du schéma peut prendre pas mal de
        temps, et nous somme online */
     $db = Strass_Db::setup($this->dbname, true);
     $dump = $this->sql_dir . '/dump-' . $this->data['site']['association'] . '.sql';
     if (!file_exists($dump)) {
         throw new Exception("Pas de données pour cette association !");
     }
     $sql = file_get_contents($dump);
     $snippets = array_filter(explode(";\n", $sql));
     foreach ($snippets as $snippet) {
         $db->exec($snippet);
     }
     Strass_Version::save(self::VERSION);
     Strass_Migrate::run($db);
 }