Ejemplo n.º 1
0
 function updatedb()
 {
     require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'install.defaultvalue.php';
     $type = 'error';
     if (!updateEasyBlogDBColumns()) {
         $message = 'Error updating DB columns';
         $this->setRedirect('index.php?option=com_easyblog', $message, $type);
         return;
     }
     if (!truncateACLTable()) {
         $message = 'Error truncating ACL table';
         $this->setRedirect('index.php?option=com_easyblog', $message, $type);
         return;
     }
     if (!updateACLRules()) {
         $message = 'Error updating ACL rules';
         $this->setRedirect('index.php?option=com_easyblog', $message, $type);
         return;
     }
     migrateJomSocialStreamNameSpace();
     $type = 'message';
     $message = 'DB Updated';
     $this->setRedirect('index.php?option=com_easyblog', $message, $type);
 }
Ejemplo n.º 2
0
 function execute()
 {
     $message = $this->message;
     $status = $this->status;
     $sourcePath = $this->sourcePath;
     //create default easy blog config
     if (!configExist()) {
         if (!createConfig()) {
             $message[] = 'Warning : The system encounter an error when it tries to create default config. Please kindly configure your Easy Blog manually.';
         }
     }
     //update Db columns first before proceed.
     updateEasyBlogDBColumns();
     //check if need to create default category
     if (!blogCategoryExist()) {
         if (!createBlogCategory()) {
             $message[] = 'Warning : The system encounter an error when it tries to create default blog categories. Please kindly create the categories manually.';
         }
     }
     //check if need to create sample post
     if (!postExist()) {
         if (!createSamplePost()) {
             $message[] = 'Warning : The system encounter an error when it tries to create some sample post.';
         }
     }
     //check if twitter table exist.
     if (twitterTableExist()) {
         //migrate twitter data if the table exist
         if (!twitterTableMigrate()) {
             $message[] = 'Warning : The system encounter an error when it tries to migrate your social share data to a new table. Please kindly migrate the data manually.';
         } else {
             if (!twitterTableRemove()) {
                 $message[] = 'Warning : The system encounter an error when it tries to remove the unused twitter table. Please kindly remove the table manually.';
             }
         }
     }
     //truncate the table before recreating the default acl rules.
     if (!truncateACLTable()) {
         $message[] = 'Fatal Error : The system encounter an error when it tries to truncate the acl rules table. Please kindly check your database permission and try again.';
         $status = false;
     }
     //update acl rules
     if (!updateACLRules()) {
         $message[] = 'Fatal Error : The system encounter an error when it tries to create the ACL rules. Please kindly check your database permission and try again.';
         $status = false;
     } else {
         //update user group acl rules
         if (!updateGroupACLRules()) {
             $message[] = 'Fatal Error : The system encounter an error when it tries to create the user groups ACL rules. Please kindly check your database permission and try again.';
             $status = false;
         }
     }
     //install default plugin.
     if (!installDefaultPlugin($sourcePath)) {
         $message[] = 'Warning : The system encounter an error when it tries to install the user plugin. Please kindly install the plugin manually.';
     }
     if (!copyMediaFiles($sourcePath)) {
         $message[] = 'Warning: The system could not copy files to Media folder. Please kindly check the media folder permission.';
         $status = false;
     }
     // migrating stream records from old JS to JS 2.8
     migrateJomSocialStreamNameSpace();
     if ($status) {
         $message[] = 'Success : Installation Completed. Thank you for choosing Easy Blog.';
     }
     $this->message = $message;
     $this->status = $status;
     return $status;
 }