<?php

function init_phabricator_script(array $options) {
  error_reporting(E_ALL | E_STRICT);
  ini_set('display_errors', 1);

  $include_path = ini_get('include_path');
  ini_set(
    'include_path',
    $include_path.PATH_SEPARATOR.dirname(__FILE__).'/../../../');

  $ok = @include_once 'arcanist/scripts/init/init-script.php';
  if (!$ok) {
    echo
      'FATAL ERROR: Unable to load the "Arcanist" library. '.
      'Put "arcanist/" next to "phabricator/" on disk.';
    echo "\n";

    exit(1);
  }

  phutil_load_library('arcanist/src');
  phutil_load_library(dirname(__FILE__).'/../../src/');

  $config_optional = $options['config.optional'];
  PhabricatorEnv::initializeScriptEnvironment($config_optional);
}

<?php

function init_phabricator_script(array $options) {
  error_reporting(E_ALL | E_STRICT);
  ini_set('display_errors', 1);

  $include_path = ini_get('include_path');
  ini_set(
    'include_path',
    $include_path.PATH_SEPARATOR.dirname(__FILE__).'/../../../');

  $ok = @include_once 'arcanist/support/init/init-script.php';
  if (!$ok) {
    echo
      'FATAL ERROR: Unable to load the "Arcanist" library. '.
      'Put "arcanist/" next to "phabricator/" on disk.';
    echo "\n";

    exit(1);
  }

  phutil_load_library('arcanist/src');
  phutil_load_library(dirname(__FILE__).'/../../src/');

  $config_optional = $options['config.optional'];
  PhabricatorEnv::initializeScriptEnvironment($config_optional);
}

Update a Phabricator -> Arcanist include path for scripts in Phabricator
Update a Phabricator -> Arcanist include path for scripts in Phabricator

Summary: Ref T13395. Since there's very little code which really makes sense in "scripts/", I've moved most of it to other places.

Test Plan: Ran `bin/phd`.

Maniphest Tasks: T13395

Differential Revision: https://secure.phabricator.com/D20994
