Пример #1
0
function com_install()
{
    global $mosConfig_absolute_path, $_DOCMAN;
    $return = true;
    // Logo
    DMInstallHelper::showLogo();
    if (!DMInstallHelper::checkWritable()) {
        $link = defined('_DM_J15') ? 'index.php?option=com_installer&type=components&task=manage&mosmsg=Select+DOCman+and+click+uninstall' : 'index2.php?option=com_installer&element=component&mosmsg=Select+DOCman+and+click+uninstall';
        // this should get the attention of people who prefer to ignore error messages!
        ?>
<p style="font-size:200%">Installation failed! Please <a href="<?php 
        echo $link;
        ?>
">click here to uninstall docman</a>.
        Next, make the folders list above writable and try again.</p>
        <?php 
        $return = false;
    }
    // Upgrade tables
    DMInstallHelper::upgradeTables();
    // Files
    DMInstallHelper::fileOperations();
    // modules
    if (defined('_DM_J15')) {
        DMInstallHelper::moduleFilesJ15();
    } else {
        DMInstallHelper::moduleFiles();
    }
    DMInstallHelper::moduleDB();
    //plugins
    DMInstallHelper::pluginFiles();
    DMInstallHelper::pluginDB();
    // index.html files
    $paths = array('components' . DS . 'com_docman', 'administrator' . DS . 'components' . DS . 'com_docman', 'mambots' . DS . 'docman', 'dmdocuments');
    foreach ($paths as $path) {
        $path = $mosConfig_absolute_path . DS . $path;
        DMInstallHelper::createIndex($path);
    }
    // Update menus
    DMInstallHelper::removeAdminMenuImages();
    DMInstallHelper::setAdminMenuImages();
    // Link to add sample data
    DMInstallHelper::cpanel();
    return $return;
}
function com_uninstall()
{
    global $_DOCMAN;
    // remove modules
    if (defined('_DM_J15')) {
        DMInstallHelper::moduleFilesJ15('delete');
    } else {
        DMInstallHelper::moduleFiles('delete');
    }
    DMInstallHelper::pluginFiles('delete');
    DMInstallHelper::pluginDb('delete');
    // if there's no more data, we remove the tables
    if (DMInstallHelper::cntDbRecords() == 0) {
        DMInstallHelper::removeTables();
    }
    // delete the data folder if it's empty
    if (DMInstallHelper::cntFiles() == 0) {
        DMInstallHelper::removeDmdocuments();
    }
}