From: vincent@cubedesigners.com Date: Mon, 11 Jul 2011 10:15:33 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=da1a3b68c3e833ec8f5e2b892f4c2e8350d59122;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index a27186acc..05d23aebe 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -1,8 +1,8 @@ con); @@ -23,8 +22,7 @@ class wsMaintenance { } } - public static function compactLinks() - { + public static function compactLinks() { global $core; $r = $core->con->select('SELECT * FROM `document_links_versions` GROUP BY document_id,links,rulers'); $keep = array(); @@ -35,13 +33,12 @@ class wsMaintenance { $keep[$r->document_id][] = $r->update; } - foreach($keep as $document_id => $dates) { + foreach ($keep as $document_id => $dates) { $core->con->execute('DELETE FROM document_links_versions WHERE document_id=' . $document_id . ' AND `update` NOT IN(' . implode(',', $dates) . ')'); } } - public static function checkSerializeLinks() - { + public static function checkSerializeLinks() { global $core; $r = $core->con->select('SELECT * FROM document_links_versions'); while ($r->fetch()) { @@ -56,8 +53,7 @@ class wsMaintenance { } } - public static function moveLinksToVersionDB() - { + public static function moveLinksToVersionDB() { global $core; $r = $core->con->select('SELECT * FROM document_links'); $d = array(); @@ -75,24 +71,22 @@ class wsMaintenance { } $c = $core->con->openCursor('document_links_versions'); - foreach($d as $document_id => $updates) { + foreach ($d as $document_id => $updates) { $c->document_id = $document_id; - foreach($updates as $date => $dummy) { + foreach ($updates as $date => $dummy) { $c->update = $date; $c->links = json_encode($d[$document_id][$date]['links']); $c->rulers = json_encode($d[$document_id][$date]['rulers']); try { $c->insert(); - } - catch(Exception $e) { + } catch (Exception $e) { // fb($e); } } } } - public static function importFromOldWS($args) - { + public static function importFromOldWS($args) { global $core; // Import des fluidbooks // Donc le dernier importé est le max dont le numéro est inférieur à 10000 @@ -114,8 +108,7 @@ class wsMaintenance { $core->refreshWSUsersTree(); } - public static function importLangs($oldBooks) - { + public static function importLangs($oldBooks) { global $core, $allTrads, $trads; // On regarde d'abord les langues que nous avons déjà $r = $core->con->select('SELECT lang_id FROM langues'); @@ -148,7 +141,7 @@ class wsMaintenance { $trad[$idl][$r->ord] = $r->text; } - foreach($trad as $idl => $t) { + foreach ($trad as $idl => $t) { $traductions = wsLang::getTraductionWithId($trad[$idl]); $allTrads[$idl] = $traductions; } @@ -157,7 +150,7 @@ class wsMaintenance { return; } - foreach($toImport as $idl) { + foreach ($toImport as $idl) { $idl = self::_getLangCode($idl); $c = $core->con->openCursor('langues'); @@ -169,8 +162,7 @@ class wsMaintenance { } } - public static function importThemes($oldBooks) - { + public static function importThemes($oldBooks) { global $core, $signatures; $r = $core->con->select('SELECT tid,sigid FROM ws.theme'); @@ -207,8 +199,7 @@ class wsMaintenance { } } - public static function importDocs($oldBooks) - { + public static function importDocs($oldBooks) { global $core; // On cherche maintenant à savoir si l'on doit importer de nouveaux documents associés $oldDocuments = array(); @@ -229,15 +220,13 @@ class wsMaintenance { $c->version = 1; try { $c->insert(); - } - catch(Exception $e) { + } catch (Exception $e) { fb($e); } } } - public static function importBooks($oldBooks) - { + public static function importBooks($oldBooks) { global $core, $allTrads, $signatures; // Importe les fluidbooks $r = $core->con->select('SELECT * FROM ws.book WHERE bid ' . self::_sqlIn($oldBooks) . ' ORDER BY bid'); @@ -270,16 +259,17 @@ class wsMaintenance { if ($xml !== false) { $parametres->fromXML($xml); } else { + } $n = array(); // Pages sans numéro - $offset = $r->first_page_nr-1; - for($i = 0;$i < $offset;$i++) { + $offset = $r->first_page_nr - 1; + for ($i = 0; $i < $offset; $i++) { $n[] = ''; } // Pages avec numero - for($j = 1;$j + $offset <= $r->pages;$j++) { + for ($j = 1; $j + $offset <= $r->pages; $j++) { $n[] = $j; } $c->numerotation = implode(',', $n); @@ -294,8 +284,7 @@ class wsMaintenance { $core->con->execute('INSERT INTO book_pages (book_id,book_page,document_id,document_page) SELECT bid,bpid,did,dpid FROM ws.book_pages WHERE bid ' . self::_sqlIn($oldBooks)); } - protected static function _oldIconesToColor($iid, &$parametres) - { + protected static function _oldIconesToColor($iid, &$parametres) { global $oldIconesColors; if (!isset($oldIconesColors)) { $oldIconesColors = array(); @@ -309,7 +298,7 @@ class wsMaintenance { $line = $oldIconesColors[$iid]; if ($line['iid'] != '') { $parametres->iconSet = $line['iid']; - $parametres->iconsHMargin = $line['iid'] == 1?20:0; + $parametres->iconsHMargin = $line['iid'] == 1 ? 20 : 0; $parametres->menuHeight = 39; $parametres->colorizeIcons = false; $parametres->couleurI = 'ffffff'; @@ -322,8 +311,7 @@ class wsMaintenance { } } - protected static function _getWsUser($oldid) - { + protected static function _getWsUser($oldid) { global $ws2ext; if (!isset($ws2ext)) { self::_getAllUsers(); @@ -337,8 +325,7 @@ class wsMaintenance { return $ws2ext[$oldid]; } - protected static function _getAllUsers() - { + protected static function _getAllUsers() { global $core, $entreprises, $entreprise_id, $utilisateurs_entreprises, $utilisateur_id, $ws2ext, $grades, $utilisateurs; $grades = array(0 => 1, 0.4 => 1, '0.4' => 1, 0.5 => 1, '0.5' => 1, 1 => 1, 2 => 2, 3 => 3, 4 => 5); // Contrôle des entreprises déjà dans la base extranet @@ -376,8 +363,7 @@ class wsMaintenance { } } - protected static function _importOldUser($oldid) - { + protected static function _importOldUser($oldid) { global $core, $entreprises, $entreprise_id, $utilisateurs_entreprises, $utilisateur_id, $ws2ext, $grades, $utilisateurs; // Get user from old $r = $core->con->select('SELECT * FROM ws.user WHERE uid=\'' . $core->con->escape($oldid) . '\''); @@ -459,13 +445,11 @@ class wsMaintenance { } } - protected static function _sqlIn($tab) - { + protected static function _sqlIn($tab) { return ' IN(\'' . implode('\',\'', $tab) . '\') '; } - protected static function _getLangCode($lang) - { + protected static function _getLangCode($lang) { $lang = strtolower($lang); if ($lang == 'cz') { $lang = 'cs'; @@ -473,15 +457,12 @@ class wsMaintenance { return $lang; } - public static function dumpDatabase() - { - cubeDb::mysqlDump('localhost', DB_NAME , DB_USER , DB_PASSWORD , ROOT . '/backups/dump-' . date('Y-m-d-H-i-s') . '.sql', true, 8); + public static function dumpDatabase() { + cubeDb::mysqlDump('localhost', DB_NAME, DB_USER, DB_PASSWORD, ROOT . '/backups/dump-' . date('Y-m-d-H-i-s') . '.sql', true, 8); } - public static function cleanPackages() - { + public static function cleanPackages() { $limit = TIME - (4 * 3600); // 4 heures avant maintenant* - // Clean downloaded packages $dir = WS_FILES . '/packager/download/'; $dr = opendir($dir); @@ -513,8 +494,7 @@ class wsMaintenance { } } - public static function cleanConversionSessions() - { + public static function cleanConversionSessions() { $limit = TIME - (4 * 3600); // 4 heures avant maintenant* $dir = ROOT . '/cache/conversionSessions/'; @@ -530,6 +510,19 @@ class wsMaintenance { unlink($f); } } + + public static function moveFluidbookDatas() { + $dir = WS_BOOKS . '/final/'; + $dr = opendir($dir); + while ($d = readdir($dr)) { + if ($d == '.' || $d == '..' || !is_dir($dir . $d)) { + continue; + } + rename($dir . $d . '/FluidbookDatas.swf', $dir . $d . '/data/fd.swf'); + rename($dir . $d . '/FluidbookDatasLight.swf', $dir . $d . '/data/fdl.swf'); + } + } + } ?> \ No newline at end of file diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 825256f78..14d14cf1b 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -761,8 +761,8 @@ class wsDAOBook extends commonDAO { $res .= $flexLight->compile(); - $filesToCopy['FluidbookDatas.swf'] = $compilerDir . '/FluidbookDatas.swf'; - $filesToCopy['FluidbookDatasLight.swf'] = $compilerDir . '/FluidbookDatasLight.swf'; + $filesToCopy['data/fd.swf'] = $compilerDir . '/FluidbookDatas.swf'; + $filesToCopy['data/fdl.swf'] = $compilerDir . '/FluidbookDatasLight.swf'; // Copy of files // Check if dest dir exists if (!file_exists($finalDir . 'data')) { diff --git a/inc/ws/Util/packager/class.ws.packager.mac.exe.php b/inc/ws/Util/packager/class.ws.packager.mac.exe.php index 69d112f11..6374f6a34 100644 --- a/inc/ws/Util/packager/class.ws.packager.mac.exe.php +++ b/inc/ws/Util/packager/class.ws.packager.mac.exe.php @@ -16,7 +16,6 @@ class wsPackagerMacEXE extends wsPackager { $this->copyFluidbookFiles(); $this->copyOtherFiles(array('Fluidbook.app.zip')); - $this->moveDatasSWF(); } public function makePackage() diff --git a/inc/ws/Util/packager/class.ws.packager.win.cd.php b/inc/ws/Util/packager/class.ws.packager.win.cd.php index d3707f6c3..16843462c 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.cd.php +++ b/inc/ws/Util/packager/class.ws.packager.win.cd.php @@ -16,7 +16,6 @@ class wsPackagerWinCD extends wsPackagerMacEXE { 'Fluidbook.exe' => 'Windows-PC-' . $this->exeName . '.exe', 'Fluidbook.app.zip')); $this->replaceAutorun(); - $this->moveDatasSWF(); } public function replaceAutorun() { diff --git a/inc/ws/Util/packager/class.ws.packager.win.exe.php b/inc/ws/Util/packager/class.ws.packager.win.exe.php index f8efed8c0..3c8515e74 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.exe.php +++ b/inc/ws/Util/packager/class.ws.packager.win.exe.php @@ -16,7 +16,6 @@ class wsPackagerWinEXE extends wsPackager { $this->copyFluidbookFiles(); $this->copyOtherFiles(array('Fluidbook.exe' => $this->exeName)); - $this->moveDatasSWF(); } public function makePackage() { diff --git a/inc/ws/Util/packager/class.ws.packager.win.inst.php b/inc/ws/Util/packager/class.ws.packager.win.inst.php index d03b6879f..d5f9b8720 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.inst.php +++ b/inc/ws/Util/packager/class.ws.packager.win.inst.php @@ -14,7 +14,6 @@ class wsPackagerWinINST extends wsPackagerWinEXE { $this->copyFluidbookFiles(); $this->copyOtherFiles(array('Fluidbook.exe' => $this->exeName)); - $this->moveDatasSWF(); $this->makeNSI(); }