Example #1
0
 public function getTotal()
 {
     if (PFMigratorHelper::fmProInstalled()) {
         return count($this->getTables());
     }
     return 1;
 }
Example #2
0
 public function getTotal()
 {
     if (!PFMigratorHelper::designsInstalled()) {
         return 1;
     }
     $query = $this->_db->getQuery(true);
     $query->select('COUNT(*)')->from('#__pf_designs_tmp')->where('rev_id = 0');
     $this->_db->setQuery($query);
     $total = (int) $this->_db->loadResult();
     return $total;
 }
Example #3
0
 public function getTotal()
 {
     if (!PFMigratorHelper::fmProInstalled()) {
         return 1;
     }
     $query = $this->_db->getQuery(true);
     $query->select('COUNT(*)')->from('#__pf_note_versions_tmp');
     $this->_db->setQuery($query);
     $total = (int) $this->_db->loadResult();
     return $total;
 }
Example #4
0
 public function process($limitstart = 0)
 {
     $cat_str = PFMigratorHelper::getConfig('cats', 'projects');
     if (empty($cat_str)) {
         return true;
     }
     $items = explode("\n", $cat_str);
     $titles = array();
     foreach ($items as $str) {
         $str = trim($str);
         $pts = explode(':', $str);
         $title = trim(htmlspecialchars($pts[0], ENT_QUOTES));
         $alias = JFilterOutput::stringURLSafe($title);
         if (empty($title) || empty($alias)) {
             continue;
         }
         if ($this->migrate($title, $alias)) {
             $titles[] = $title;
         }
     }
     $titles = implode(', ', $titles);
     $this->log[] = JText::sprintf('COM_PFMIGRATOR_MIGRATE_PCATS_SUCCESS', $titles);
     return true;
 }
Example #5
0
 protected function getDesign($id)
 {
     static $cache = array();
     if (isset($cache[$id])) {
         return $cache[$id];
     }
     if (!PFMigratorHelper::designsInstalled()) {
         return false;
     }
     $query = $this->_db->getQuery(true);
     $query->select('project_id, state, access')->from('#__pf_designs')->where('id = ' . (int) $id);
     $this->_db->setQuery($query);
     $object = $this->_db->loadObject();
     if (empty($object)) {
         $cache[$id] = false;
     } else {
         $cache[$id] = $object;
     }
     return $cache[$id];
 }
Example #6
0
 public function process($limitstart = 0)
 {
     if (!PFMigratorHelper::designsInstalled()) {
         $this->log[] = JText::_('COM_PFMIGRATOR_DESIGNS_NOT_INSTALLED');
         return true;
     }
     require_once JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php';
     JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_installer/models');
     // Path to the package
     $pkg = JPATH_ADMINISTRATOR . '/components/com_pfmigrator/_install/com_pfdesigns_4.0.1.zip';
     $dest = JFactory::getConfig()->get('tmp_path') . '/com_pfdesigns_4.0.1.zip';
     // Check if the package exists
     if (!file_exists($pkg)) {
         $this->success = false;
         $this->log[] = JText::_('COM_PFMIGRATOR_PKG_DESIGNS_NOT_FOUND');
         return false;
     }
     // Copy package to tmp dir
     if (!JFile::copy($pkg, $dest)) {
         $this->success = false;
         $this->log[] = JText::_('COM_PFMIGRATOR_PKG_DESIGNS_COPY_FAILED');
         return false;
     }
     // Unpack the package file
     $package = JInstallerHelper::unpack($dest);
     if (!$package) {
         if (JFile::exists($dest)) {
             JFile::delete($dest);
         }
         $this->success = false;
         $this->log[] = JText::_('COM_PFMIGRATOR_PKG_DESIGNS_EXTRACT_FAILED');
         return false;
     }
     $installer = JInstaller::getInstance();
     // Install the package
     if (!$installer->install($package['dir'])) {
         if (JFile::exists($dest)) {
             JFile::delete($dest);
         }
         $this->success = false;
         $this->log[] = JText::_('COM_PFMIGRATOR_PKG_DESIGNS_INSTALL_FAILED');
         return false;
     }
     // Cleanup the install files
     if (!is_file($package['packagefile'])) {
         $config = JFactory::getConfig();
         $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile'];
     }
     JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']);
     // Update the config
     $path = $this->getUploadPath();
     if (!$path) {
         $this->success = false;
         $this->log[] = JText::_('COM_PFMIGRATOR_PREPDESIGNS_UPLOAD_DIR_ERROR');
         return false;
     }
     $query = $this->_db->getQuery(true);
     $query->select($this->_db->quoteName('params'))->from('#__extensions')->where($this->_db->quoteName('type') . ' = ' . $this->_db->quote('component'))->where($this->_db->quoteName('element') . ' = ' . $this->_db->quote('com_pfdesigns'));
     $this->_db->setQuery($query, 0, 1);
     $params = $this->_db->loadResult();
     $base_path = str_replace(JPATH_SITE . DS, '', $path);
     $registry = new JRegistry();
     $registry->loadString($params);
     $registry->set('design_basepath', $base_path);
     $attribs = strval($registry);
     $query->clear();
     $query->update('#__extensions')->set($this->_db->quoteName('params') . ' = ' . $this->_db->quote($attribs))->where($this->_db->quoteName('type') . ' = ' . $this->_db->quote('component'))->where($this->_db->quoteName('element') . ' = ' . $this->_db->quote('com_pfdesigns'));
     $this->_db->setQuery($query);
     if (!$this->_db->execute()) {
         $this->success = false;
         $this->log[] = $this->_db->getError();
         return false;
     }
     $this->log[] = JText::_('COM_PFMIGRATOR_PKG_DESIGNS_INSTALL_SUCCESS');
     return true;
 }
Example #7
0
 /**
  * Method to get the list of processes
  *
  * @return    array
  */
 public function getItems()
 {
     $app = JFactory::getApplication();
     $proc = $this->process;
     $items = array();
     // 1. Rename PF 3 tables
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_RENAME_TABLES');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_RENAME_TABLES_DESC');
     $item['model'] = 'RenameTables';
     $item['active'] = false;
     $items[] = $item;
     // 2. Rename PF 3 folders
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_RENAME_FOLDERS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_RENAME_FOLDERS_DESC');
     $item['model'] = 'RenameFolders';
     $item['active'] = false;
     $items[] = $item;
     // 3. Unregister PF 3
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_UNREG_PF3');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_UNREG_PF3_DESC');
     $item['model'] = 'UnregisterPF';
     $item['active'] = false;
     $items[] = $item;
     // 4. Install PF 4
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_INSTALL_PF');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_INSTALL_PF_DESC');
     $item['model'] = 'InstallPF';
     $item['active'] = false;
     $items[] = $item;
     // 5. Migrate Project Categories
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_CATS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_CATS_DESC');
     $item['model'] = 'projectcats';
     $item['active'] = false;
     $items[] = $item;
     // 6. Migrate projects
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_PROJECTS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_PROJECTS_DESC');
     $item['model'] = 'projects';
     $item['active'] = false;
     $items[] = $item;
     // 7. Prepare Access migration
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_PREP_ACCESS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_PREP_ACCESS_DESC');
     $item['model'] = 'prepaccess';
     $item['active'] = false;
     $items[] = $item;
     // 8. Access migration
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_ACCESS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_ACCESS_DESC');
     $item['model'] = 'access';
     $item['active'] = false;
     $items[] = $item;
     // 9. Milestones migration
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_MILESTONES');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_MILESTONES_DESC');
     $item['model'] = 'milestones';
     $item['active'] = false;
     $items[] = $item;
     // 10. Tasks migration
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_TASKS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_TASKS_DESC');
     $item['model'] = 'tasks';
     $item['active'] = false;
     $items[] = $item;
     // 11. Forum migration
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_FORUM');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_FORUM_DESC');
     $item['model'] = 'forum';
     $item['active'] = false;
     $items[] = $item;
     // 12. Time sheet migration
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_TIME');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_TIME_DESC');
     $item['model'] = 'time';
     $item['active'] = false;
     $items[] = $item;
     // 13. Prepare repo
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_PREP_REPO');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_PREP_REPO_DESC');
     $item['model'] = 'preprepo';
     $item['active'] = false;
     $items[] = $item;
     // 14. Migrate folders
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPODIRS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPODIRS_DESC');
     $item['model'] = 'repodirs';
     $item['active'] = false;
     $items[] = $item;
     // 15. Migrate notes
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPONOTES');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPONOTES_DESC');
     $item['model'] = 'reponotes';
     $item['active'] = false;
     $items[] = $item;
     // 16. Migrate files
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPOFILES');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPOFILES_DESC');
     $item['model'] = 'repofiles';
     $item['active'] = false;
     $items[] = $item;
     if (PFMigratorHelper::designsInstalled()) {
         // 17. Prepare FM Pro migration
         $item = array();
         $item['title'] = JText::_('COM_PFMIGRATOR_PROC_PREP_FMPRO');
         $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_PREP_FMPRO_DESC');
         $item['model'] = 'prepfmpro';
         $item['active'] = false;
         $items[] = $item;
         // 18. Migrate note revisions
         $item = array();
         $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPONOTEREVS');
         $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPONOTEREVS_DESC');
         $item['model'] = 'reponoterevs';
         $item['active'] = false;
         $items[] = $item;
         // 19. Migrate file revisions
         $item = array();
         $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPOFILEREVS');
         $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_REPOFILEREVS_DESC');
         $item['model'] = 'repofilerevs';
         $item['active'] = false;
         $items[] = $item;
     }
     if (PFMigratorHelper::designsInstalled()) {
         // 20. Prepare Designs migration
         $item = array();
         $item['title'] = JText::_('COM_PFMIGRATOR_PROC_PREP_DESIGNS');
         $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_PREP_DESIGNS_DESC');
         $item['model'] = 'prepdesigns';
         $item['active'] = false;
         $items[] = $item;
         // 21. Install Designs dummy extension
         $item = array();
         $item['title'] = JText::_('COM_PFMIGRATOR_PROC_INSTALL_DESIGNS');
         $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_INSTALL_DESIGNS_DESC');
         $item['model'] = 'installdesigns';
         $item['active'] = false;
         $items[] = $item;
         // 22. Migrate Designs
         $item = array();
         $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_DESIGNS');
         $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_DESIGNS_DESC');
         $item['model'] = 'designs';
         $item['active'] = false;
         $items[] = $item;
     }
     // 23. Comments
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_COMMENTS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_COMMENTS_DESC');
     $item['model'] = 'comments';
     $item['active'] = false;
     $items[] = $item;
     // 24. Attachments
     $item = array();
     $item['title'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_ATTACHMENTS');
     $item['desc'] = JText::_('COM_PFMIGRATOR_PROC_MIGRATE_ATTACHMENTS_DESC');
     $item['model'] = 'attachments';
     $item['active'] = false;
     $items[] = $item;
     // Set active process
     foreach ($items as $i => $item) {
         if ($i == $proc) {
             $items[$i]['active'] = true;
         }
     }
     return $items;
 }