Commit 4fd42deb authored by totten's avatar totten Committed by GitHub

Merge pull request #121 from totten/master-setup

Installation - If available, use the new installer package
parents 9063b3b7 1829630e
......@@ -792,6 +792,37 @@ 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::assertProtocolCompatibility(0.1);
\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