Commit f6584a40 authored by totten's avatar totten

Installation UI - If available, use the new installer

`civicrm-core` includes an installer (`civicrm/install/index.php`), but this
code is difficult to update/maintain.  The `civicrm-setup`
(http://github.com/civicrm/civicrm-setup/) package is a "leap" to replace it
with a more maintable library.

This patch uses whichever is available.

Before
------
 * The page `civicrm-install` always uses `civicrm/install/index.php`.

After
-----
 * The page `civicrm-install` picks the first available installer UI, either:
   * `civicrm/packages/civicrm-setup/*` (`Civi\Setup::createController()`)
   * `civicrm/install/index.php`
parent 9063b3b7
......@@ -792,6 +792,36 @@ class CiviCRM_For_WordPress {
* @return void
*/
public function run_installer() {
$civicrmCore = CIVICRM_PLUGIN_DIR . 'civicrm';
$setupPaths = array(
implode(DIRECTORY_SEPARATOR, ['vendor', 'civicrm', 'civicrm-setup']),
implode(DIRECTORY_SEPARATOR, ['packages', 'civicrm-setup',]),
implode(DIRECTORY_SEPARATOR, ['setup']),
);
foreach ($setupPaths as $setupPath) {
$loader = implode(DIRECTORY_SEPARATOR, [$civicrmCore, $setupPath, 'civicrm-setup-autoload.php']);
if (file_exists($loader)) {
require_once $loader;
require_once implode(DIRECTORY_SEPARATOR, [$civicrmCore, 'CRM', 'Core', 'ClassLoader.php']);
CRM_Core_ClassLoader::singleton()->register();
\Civi\Setup::init([
'cms' => 'WordPress',
'srcPath' => $civicrmCore,
'setupPath' => dirname($loader),
]);
$ctrl = \Civi\Setup::instance()->createController()->getCtrl();
$ctrl->setUrls(array(
'ctrl' => admin_url() . "options-general.php?page=civicrm-install",
'res' => CIVICRM_PLUGIN_URL . 'civicrm/' . strtr($setupPath, DIRECTORY_SEPARATOR, '/') . '/res/',
'jquery.js' => CIVICRM_PLUGIN_URL . 'civicrm/bower_components/jquery/dist/jquery.min.js',
'font-awesome.css' => CIVICRM_PLUGIN_URL . 'civicrm/bower_components/font-awesome/css/font-awesome.min.css',
'finished' => admin_url('admin.php?page=CiviCRM&q=civicrm&reset=1'),
));
\Civi\Setup\BasicRunner::run($ctrl);
return;
}
}
// uses CIVICRM_PLUGIN_DIR instead of WP_PLUGIN_DIR
$installFile =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment