示例#1
0
 /**
  * Called after any type of action
  *
  * @param     string              $route      Which action is happening (install|uninstall|discover_install)
  * @param     jadapterinstance    $adapter    The object responsible for running this script
  *
  * @return    boolean                         True on success
  */
 public function postflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install') {
         $element = $adapter->get('element');
         // Restore assets from backup
         PFInstallerHelper::restoreAssets($element);
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
         // Create a menu item in the projectfork site menu
         $com = JComponentHelper::getComponent($element);
         $eid = is_object($com) && isset($com->id) ? $com->id : 0;
         if ($eid) {
             $item = array();
             $item['title'] = 'Time Tracking';
             $item['alias'] = 'timetracking';
             $item['link'] = 'index.php?option=' . $element . '&view=timesheet';
             $item['component_id'] = $eid;
             PFInstallerHelper::addMenuItem($item);
         }
     }
     if (strtolower($route) == 'update') {
         $element = $adapter->get('element');
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
     }
     return true;
 }
示例#2
0
 /**
  * Called after any type of action
  *
  * @param     string              $route      Which action is happening (install|uninstall|discover_install)
  * @param     jadapterinstance    $adapter    The object responsible for running this script
  *
  * @return    boolean                         True on success
  */
 public function postflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install') {
         // Get the XML manifest data
         $manifest = $adapter->get('manifest');
         // Set the module params
         PFInstallerHelper::setModuleParams($manifest);
     }
     return true;
 }
示例#3
0
 /**
  * Called after any type of action
  *
  * @param     string              $route      Which action is happening (install|uninstall|discover_install)
  * @param     jadapterinstance    $adapter    The object responsible for running this script
  *
  * @return    boolean                         True on success
  */
 public function postflight($route, JAdapterInstance $adapter)
 {
     $action = strtolower($route);
     if ($action == 'install') {
         // Get the XML manifest data
         $manifest = $adapter->get('manifest');
         // Get plugin published state
         $name = $manifest->name;
         $state = isset($manifest->published) ? (int) $manifest->published : 0;
         if ($state) {
             PFInstallerHelper::publishPlugin($name, $state);
         }
     }
     // Move CLI scripts to cli folder
     if ($action == 'install' || $action == 'update') {
         $cli_j2_source = JPATH_SITE . '/plugins/content/pfnotifications/pfnotifications_j2.php';
         $cli_j2_dest = JPATH_SITE . '/cli/pfnotifications_j2.php';
         $cli_j3_source = JPATH_SITE . '/plugins/content/pfnotifications/pfnotifications_j3.php';
         $cli_j3_dest = JPATH_SITE . '/cli/pfnotifications_j3.php';
         if (file_exists($cli_j2_source)) {
             if (file_exists($cli_j2_dest)) {
                 if (JFile::delete($cli_j2_dest)) {
                     JFile::copy($cli_j2_source, $cli_j2_dest);
                 }
             } else {
                 JFile::copy($cli_j2_source, $cli_j2_dest);
             }
         }
         if (file_exists($cli_j3_source)) {
             if (file_exists($cli_j3_dest)) {
                 if (JFile::delete($cli_j3_dest)) {
                     JFile::copy($cli_j3_source, $cli_j3_dest);
                 }
             } else {
                 JFile::copy($cli_j3_source, $cli_j3_dest);
             }
         }
     }
     // Remove CLI scripts
     if ($action == 'uninstall') {
         $cli_j2_dest = JPATH_SITE . '/cli/pfnotifications_j2.php';
         $cli_j3_dest = JPATH_SITE . '/cli/pfnotifications_j3.php';
         if (file_exists($cli_j2_dest)) {
             JFile::delete($cli_j2_dest);
         }
         if (file_exists($cli_j3_dest)) {
             JFile::delete($cli_j3_dest);
         }
     }
     return true;
 }
示例#4
0
文件: script.php 项目: MrJookie/pm
 /**
  * Called after any type of action
  *
  * @param     string              $route      Which action is happening (install|uninstall|discover_install)
  * @param     jadapterinstance    $adapter    The object responsible for running this script
  *
  * @return    boolean                         True on success
  */
 public function postflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install' || strtolower($route) == 'update') {
         // Get the XML manifest data
         $manifest = $adapter->get('manifest');
         // Get plugin published state
         $name = $manifest->name;
         $state = isset($manifest->published) ? (int) $manifest->published : 0;
         if ($state) {
             PFInstallerHelper::publishPlugin($name, $state);
         }
     }
     return true;
 }
示例#5
0
 /**
  * Called after any type of action
  *
  * @param     string              $route      Which action is happening (install|uninstall|discover_install)
  * @param     jadapterinstance    $adapter    The object responsible for running this script
  *
  * @return    boolean                         True on success
  */
 public function postflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install') {
         $element = $adapter->get('element');
         // Restore assets from backup
         PFInstallerHelper::restoreAssets($element);
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
     }
     if (strtolower($route) == 'update') {
         $element = $adapter->get('element');
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
     }
     return true;
 }
示例#6
0
文件: script.php 项目: MrJookie/pm
 /**
  * Called after any type of action
  *
  * @param     string              $route      Which action is happening (install|uninstall|discover_install)
  * @param     jadapterinstance    $adapter    The object responsible for running this script
  *
  * @return    boolean                         True on success
  */
 public function postflight($route, JAdapterInstance $adapter)
 {
     if (strtolower($route) == 'install') {
         $element = $adapter->get('element');
         // Restore assets from backup
         PFInstallerHelper::restoreAssets($element);
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
         // Create a menu item in the projectfork site menu
         $com = JComponentHelper::getComponent($element);
         $eid = is_object($com) && isset($com->id) ? $com->id : 0;
         if ($eid) {
             $item = array();
             $item['title'] = 'Designs';
             $item['alias'] = 'designs';
             $item['link'] = 'index.php?option=' . $element . '&view=designs';
             $item['component_id'] = $eid;
             PFInstallerHelper::addMenuItem($item);
         }
     }
     if (strtolower($route) == 'update') {
         $element = $adapter->get('element');
         // Make the admin component menu item a child of com_projectfork
         PFInstallerHelper::setComponentMenuItem($element);
         // Delete duplicate top-level admin menu entry if it exists
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('id')->from('#__menu')->where('level = 1')->where('menutype = ' . $db->quote('main'))->where('link = "index.php?option=' . $element . '&view=designs"');
         $db->setQuery($query);
         $item_id = (int) $db->loadResult();
         if ($item_id) {
             $menu = JTable::getInstance('menu');
             $menu->delete($item_id);
         }
     }
     if (in_array(strtolower($route), array('install', 'update'))) {
         $this->installPlugins($adapter);
     }
     return true;
 }
 *
 * @author       Tobias Kuhn (eaxs)
 * @copyright    Copyright (C) 2006-2012 Tobias Kuhn. All rights reserved.
 * @license      http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt
 */
defined('_JEXEC') or die;
// Get new component id.
$com = JComponentHelper::getComponent('com_projectfork');
$com_id = is_object($com) && isset($com->id) ? $com->id : 0;
if ($com_id) {
    $item = array();
    $item['title'] = 'Dashboard';
    $item['alias'] = 'dashboard';
    $item['link'] = 'index.php?option=com_projectfork&view=dashboard';
    $item['component_id'] = $com_id;
    PFInstallerHelper::addMenuItem($item);
}
// Restore admin component menu item if not exists (Joomla 3.4)
if (version_compare(JVERSION, '3.4', 'ge')) {
    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    // Check if the menu item exists
    $query->select('id')->from('#__menu')->where('title = ' . $db->quote('com_projectfork'))->where('menutype = ' . $db->quote('main'))->where('client_id = 1');
    $db->setQuery($query);
    $menu_id = (int) $db->loadResult();
    if ($menu_id) {
        return true;
    }
    $data = array();
    $data['menutype'] = 'main';
    $data['title'] = 'com_projectfork';
$app = JFactory::getApplication();
$folder = dirname(__FILE__) . '/script_postprocess';
$query = $db->getQuery(true);
// Check if the scripts folder exists
if (!JFolder::exists($folder)) {
    $app->enqueueMessage('Post-process script update folder not found!');
    return false;
}
// Get all script files
$files = (array) str_replace('.php', '', JFolder::files($folder, '\\.php$'));
usort($files, 'version_compare');
// Iterate through all scripts
foreach ($files as $file) {
    if (version_compare($file, $prev_version, '>')) {
        // Run the script
        if (file_exists($folder . '/' . $file . '.php')) {
            require_once $folder . '/' . $file . '.php';
        }
    }
}
// Restore com_pfdesigns admin menu item
$query->clear();
$query->select('extension_id')->from('#__extensions')->where('name = ' . $db->quote('com_pfdesigns'))->where('type = ' . $db->quote('component'));
$db->setQuery($query);
$designs_id = $db->loadResult();
if ($designs_id) {
    if (!defined('PF_LIBRARY')) {
        jimport('projectfork.library');
    }
    PFInstallerHelper::setComponentMenuItem('com_pfdesigns');
}