Ejemplo n.º 1
0
 function copyFiles()
 {
     clearstatcache();
     $status =& DMStatus::getInstance();
     $root = JPATH_ROOT;
     $site = $root . DS . 'components' . DS . 'com_docman';
     $admin = $root . DS . 'administrator' . DS . 'components' . DS . 'com_docman';
     // dmdocuments
     $dmdoc = $root . DS . _DM_DEFAULT_DATA_FOLDER;
     @mkdir($dmdoc, 0755, true);
     @copy($admin . DS . 'htaccess.txt', $dmdoc . DS . '.htaccess');
     @copy($site . DS . 'index.html', $dmdoc . DS . 'index.html');
     if (!file_exists($dmdoc . DS . '.htaccess')) {
         $status->addMsg("Couldn't secure <strong>{$dmdoc}</strong>. Please create the folder yourself. Next copy {$admin}" . DS . "htaccess.txt to {$dmdoc}" . DS . ".htaccess");
     }
     $files = self::getFiles();
     foreach ($files as $src => $dest) {
         @mkdir(dirname($dest), 0755);
         @copy($src, $dest);
         if (!file_exists($dest)) {
             $status->addMsg("Couldn't copy the following file: <br /><strong>Source: </strong>{$src}<br /><strong>Destination</strong>{$dest}<br />");
         }
     }
     JFolder::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_docman' . DS . 'ext' . DS . 'plugins' . DS . 'editors-xtd' . DS . 'doclink' . DS, JPATH_ROOT . DS . 'plugins' . DS . 'editors-xtd' . DS . 'doclink');
 }
Ejemplo n.º 2
0
function com_install()
{
    global $install_type;
    // Joomla's archive handler eats a lot of memory
    if ((int) ini_get('memory_limit') < 24) {
        @ini_set('memory_limit', '24M');
    }
    $lang = JFactory::getLanguage();
    $lang->load('com_installer');
    $tasks = array('copyFiles', 'insertInDb', 'removeAdminMenuImages', 'setAdminMenuImages', 'cpanel', 'track');
    $status =& DMStatus::getInstance();
    $args = array();
    if ($install_type === 'update') {
        $args[] = true;
    }
    while ($status->get() && ($task = array_shift($tasks))) {
        call_user_func_array(array('DMInstallHelper', $task), $args);
    }
    echo '<ul>';
    foreach ($status->getMsgs() as $msg) {
        echo '<li>' . $msg . '</li>';
    }
    echo '</ul>';
    return $status->get();
}
function com_install()
{
    $tasks = array('logo', 'files', 'moduleDB', 'pluginDB', 'upgradeTables', 'removeAdminMenuImages', 'setAdminMenuImages', 'cpanel');
    $status =& DMStatus::getInstance();
    while ($status->get() && ($task = array_shift($tasks))) {
        call_user_func(array('DMInstallHelper', $task));
    }
    echo '<ul>';
    foreach ($status->getMsgs() as $msg) {
        echo '<li>' . $msg . '</li>';
    }
    echo '</ul>';
    return $status->get();
}
Ejemplo n.º 4
0
 function copyFiles($is_update = false)
 {
     clearstatcache();
     $status =& DMStatus::getInstance();
     $root = JPATH_ROOT;
     $site = $root . DS . 'components' . DS . 'com_docman';
     $admin = $root . DS . 'administrator' . DS . 'components' . DS . 'com_docman';
     // dmdocuments
     $dmdoc = $root . DS . _DM_DEFAULT_DATA_FOLDER;
     if (!is_dir($dmdoc) && !$is_update) {
         @mkdir($dmdoc, 0755, true);
         @copy($admin . DS . 'htaccess.txt', $dmdoc . DS . '.htaccess');
         @copy($site . DS . 'index.html', $dmdoc . DS . 'index.html');
         if (!file_exists($dmdoc . DS . '.htaccess')) {
             $status->addMsg("Couldn't secure <strong>{$dmdoc}</strong>. Please create the folder yourself. Next copy {$admin}" . DS . "htaccess.txt to {$dmdoc}" . DS . ".htaccess");
         }
     }
     $admin_path = JPATH_ROOT . '/administrator/components/com_docman';
     if (!$is_update) {
         if (!file_exists($admin_path . '/docman.config.defaults.php') || !JFile::copy($admin_path . '/docman.config.defaults.php', $admin_path . '/docman.config.php')) {
             $status->addMsg('Cannot find default configuration file for DOCman. You need to save the configuration options yourself in the component.');
         }
     }
     // create the folders
     $folders = DMInstallHelper::getFolders();
     foreach ($folders as $folder) {
         if (!is_dir($folder)) {
             JFolder::create($folder);
         }
     }
     // plugins/docman is separate, because we don't want to delete on uninstall
     if (!is_dir(JPATH_ROOT . DS . 'plugins' . DS . 'docman')) {
         JFolder::create(JPATH_ROOT . DS . 'plugins' . DS . 'docman');
     }
     //create the files
     $files = DMInstallHelper::getFiles();
     foreach ($files as $src => $dest) {
         JFile::copy($src, $dest);
         if (!file_exists($dest)) {
             $status->addMsg("Couldn't copy the following file: <br /><strong>Source: </strong>{$src}<br /><strong>Destination</strong>{$dest}<br />");
         }
     }
     //create the folder of plugins editors-xtd doclink
     JFolder::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_docman' . DS . 'ext' . DS . 'plugins' . DS . 'editors-xtd' . DS . 'doclink' . DS . 'images' . DS, JPATH_ROOT . DS . 'plugins' . DS . 'editors-xtd' . DS . 'doclink' . DS . 'images', '', true);
     JFolder::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_docman' . DS . 'ext' . DS . 'plugins' . DS . 'editors-xtd' . DS . 'doclink' . DS . 'lang' . DS, JPATH_ROOT . DS . 'plugins' . DS . 'editors-xtd' . DS . 'doclink' . DS . 'lang', '', true);
     JFolder::copy(JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_docman' . DS . 'ext' . DS . 'plugins' . DS . 'editors-xtd' . DS . 'doclink' . DS . 'popups' . DS, JPATH_ROOT . DS . 'plugins' . DS . 'editors-xtd' . DS . 'doclink' . DS . 'popups', '', true);
 }
 /**
  * Upgrade tables from 1.3rc2/1.4beta2 style to 1.4rc1 style
  */
 function upgradeTables()
 {
     global $database;
     $status =& DMStatus::getInstance();
     $queries = array();
     $database->setQuery("SHOW INDEX FROM #__docman");
     $database->query();
     $num_keys = $database->getNumRows();
     switch ($num_keys) {
         case 1:
             // there's only a primary index, add some more
             $queries[] = "ALTER TABLE `#__docman` ADD INDEX `pub_appr_own_cat_name`  (`published`, `approved`, `dmowner`, `catid`, `dmname`(64))";
             $queries[] = "ALTER TABLE `#__docman` ADD INDEX `appr_pub_own_cat_date`  (`approved`, `published`, `dmowner`, `catid`, `dmdate_published`)";
             $queries[] = "ALTER TABLE `#__docman` ADD INDEX `own_pub_appr_cat_count` (`dmowner`, `published`, `approved`, `catid`, `dmcounter`)";
             // pass through (more can be added later on)
         // pass through (more can be added later on)
         default:
             break;
     }
     foreach ($queries as $query) {
         $database->setQuery($query);
         if (!$database->query()) {
             $status->addMsg('Error upgrading tables');
         }
     }
 }