2011-01-10 00:22:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2012-03-20 03:17:03 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-01-10 00:22:25 +01:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
$include_path = ini_get('include_path');
|
2012-03-05 19:02:37 +01:00
|
|
|
|
|
|
|
$parent_dir = dirname(dirname(dirname(__FILE__)));
|
|
|
|
|
Change order of include_path
Summary:
With the current order of the include_path (checking in the parent dir of
arcanist last), it is possible to load the wrong libphutil which can have
bad side effects. Instead, the first place we check in include_path should
be the parent dir of arcanist.
(The issue I ran into is that I had a checkout of libphutil in my homedir,
and I was running arc from my homedir with --load-phutil-library to load
the libraries, and since ./ is the default value for include_path, we were
loading libphutil from my homedir instead of from alongside the copy of arc
that I was running. The libphutil alongside that copy of arc worked, but my
checkout of libphutil had D2545 in it, so it was broken.)
Test Plan:
ran arc (not in my homedir) with a broken libphutil in my homedir in my homedir
and it worked (before this change it didn't)
Reviewers: jungejason, vrana, epriestley
Reviewed By: vrana
CC: aran, Koolvin
Differential Revision: https://secure.phabricator.com/D2576
2012-05-25 19:08:28 +02:00
|
|
|
ini_set('include_path', $parent_dir.PATH_SEPARATOR.$include_path);
|
2012-03-20 03:17:03 +01:00
|
|
|
@include_once 'libphutil/scripts/__init_script__.php';
|
2011-01-10 00:22:25 +01:00
|
|
|
if (!@constant('__LIBPHUTIL__')) {
|
|
|
|
echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to ".
|
|
|
|
"include the parent directory of libphutil/.\n";
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2012-03-05 19:02:37 +01:00
|
|
|
phutil_load_library(dirname(dirname(__FILE__)).'/src/');
|