Version 1
[yaffs-website] / vendor / drush / drush / drush
1 #!/usr/bin/env php
2 <?php
3
4 /**
5  * This is the Drush "finder" script, which is one part of the
6  * Drush dispatching chain.  This is the script that
7  * should appear in your global $PATH, or, if using Composer
8  * (as usually the case), will be found in your vendor/bin directory.
9  *
10  *
11  * - Never copy this script to your site root. Copy examples/drush instead.
12  *
13  * - Never copy this script to a directory other than its install directory.
14  * Symlink to it instead.
15  *
16  *
17  * OVERVIEW OF DRUSH FINDER / WRAPPER / LAUNCHER SCRIPTS
18  *
19  * When the user types "drush", up to three scripts might be
20  * involved in the initial launch:
21  *
22  *   "drush finder" -> "drush wrapper" -> "drush launcher".
23  *
24  * Brief description of each:
25  *
26  *  - Drush finder:   Finds the right Drush script and calls it.
27  *  - Drush wrapper:  Contains user customizations to options.
28  *  - Drush launcher: Excutes drush.php.
29  *
30  * A full explanation of each script follows.
31  *
32  *
33  * DRUSH FINDER
34  *
35  * - The "drush" script on the user's global $PATH
36  * - It's goal is to find the correct site-local Drush to run.
37  *
38  * The Drush finder will locate the correct site-local Drush to use
39  * by examining:
40  *
41  *   a) The --root option
42  *   b) The site set via `drush site set` in the current terminal
43  *   c) The cwd
44  *
45  * If no site-local Drush is found, then the global Drush will be
46  * used.  The Drush finder assumes that the global Drush is the
47  * "Drush launcher" found in the same directory as the Drush finder itself.
48  *
49  * If a site-local Drush is found, then the Drush finder will call
50  * either the "Drush wrapper", if it exists, or the "Drush launcher" if
51  * there is no wrapper script.
52  *
53  *
54  * DRUSH WRAPPER
55  *
56  * - The drush.wrapper script that the user optionally copies and edits.
57  * - Its goal is to allow the user to add options when --local is in use
58  *
59  * The Drush "wrapper" is found at examples/drush.wrapper, and may optionally
60  * be copied to __ROOT__ by the user.  It may be named either
61  * "drush" or "drush.wrapper".  It will call the "Drush launcher"
62  * for the same site that it is located in.  It adds the --local flag; the
63  * user is encouraged to add other options to the "Drush wrapper", e.g. to set
64  * the location where aliases and global commandfiles can be found.
65  * The Drush "finder" script always calls the "Drush wrapper" if it exists;
66  * however, if the user does not want to customize the early options of
67  * the site-local Drush (site-alias locations, etc.), then the wrapper does not
68  * need to be used.
69  *
70  *
71  * DRUSH LAUNCHER
72  *
73  * - The "drush.launcher" script in vendor/bin
74  * - The bash script formerly called "drush"
75  *
76  * The "Drush launcher" is the traditional script that identifies PHP and
77  * sets up to call drush.php.  It is called by the "Drush wrapper", or
78  * directly by the "Drush launcher" if there is no "Drush wrapper" in use.
79  *
80  *
81  * LOCATIONS FOR THESE SCRIPTS
82  *
83  *   "Drush finder"   :  __ROOT__/vendor/bin/drush           (composer install)
84  *                       __DRUSH__/drush                     (source)
85  *
86  *   "Drush wrapper"  :  __ROOT__/drush                      (copied by user)
87  *                       __DRUSH__/examples/drush.wrapper    (source)
88  *
89  *   "Drush launcher" :  __ROOT__/vendor/bin/drush.launcher  (composer install)
90  *                       __DRUSH__/drush.launcher            (source)
91  *
92  *
93  * BACKEND CALL DISPATCHING
94  *
95  * Backend calls are typically set up to call the "drush" script in the $PATH,
96  * or perhaps some might call __ROOT__/vendor/bin/drush directly, by way
97  * of the "drush-script" element in a site alias.  In either event, this is
98  * the "drush finder" script.
99  *
100  * The backend call will always set --root.  The "Drush finder" script
101  * always favors the site-local Drush stored with the site indicated by the
102  * --root option, if it exists.  If there is no site-local Drush, then the
103  * "Drush finder" will behave as usual (i.e., it will end up calling the
104  * "Drush launcher" located next to it).
105  *
106  * This should always get you the correct "Drush" for local and remote calls.
107  * Note that it is also okay for aliases to specify a path directly to
108  * drush.launcher, in instances where it is known that a recent version of
109  * Drush is installed on the remote end.
110  */
111
112 if (!function_exists("drush_startup")) {
113   include __DIR__ . '/includes/startup.inc';
114 }
115 drush_startup($argv);