Drush: commands/pm/info.pm.inc Source File

  1. 7.x doxygen/html/info_8pm_8inc_source.html
  2. master doxygen/html/info_8pm_8inc_source.html
Go to the documentation of this file.
1 <?php
2 
3 /**
4  * @file
5  * pm-info command implementation.
6  */
7 
8 /**
9  * Command callback. Show detailed info for one or more extensions.
10  */
11 function drush_pm_info() {
12  $result = array();
14 
15  $extension_info = drush_get_extensions(FALSE);
16  _drush_pm_expand_extensions($args, $extension_info);
17  // If no extensions are provided, show all.
18  if (count($args) == 0) {
19  $args = array_keys($extension_info);
20  }
21 
22  foreach ($args as $extension) {
23  if (isset($extension_info[$extension])) {
24  $info = $extension_info[$extension];
25  }
26  else {
27  drush_log(dt('!extension was not found.', array('!extension' => $extension)), 'warning');
28  continue;
29  }
30  if (drush_extension_get_type($info) == 'module') {
31  $data = _drush_pm_info_module($info);
32  }
33  else {
34  $data = _drush_pm_info_theme($info);
35  }
36  $result[$extension] = $data;
37  }
38  return $result;
39 }
40 
41 /**
42  * Output format formatter-filter callback.
43  *
44  * @see drush_parse_command()
45  * @see drush_outputformat
46  */
48  $result = array();
49  foreach ($data as $extension => $info) {
50  foreach($info as $key => $value) {
51  if (is_array($value)) {
52  if (empty($value)) {
53  $value = 'none';
54  }
55  else {
56  $value = implode(', ', $value);
57  }
58  }
59  $result[$extension][$key] = $value;
60  }
61  }
62  return $result;
63 }
64 
65 /**
66  * Return an array with general info of an extension.
67  */
68 function _drush_pm_info_extension($info) {
69  $data['extension'] = drush_extension_get_name($info);
70  $data['project'] = isset($info->info['project'])?$info->info['project']:dt('Unknown');
71  $data['type'] = drush_extension_get_type($info);
72  $data['title'] = $info->info['name'];
73  $data['config'] = isset($info->info['configure']) ? $info->info['configure'] : dt('None');
74  $data['description'] = $info->info['description'];
75  $data['version'] = $info->info['version'];
76  $data['date'] = isset($info->info['datestamp']) ? format_date($info->info['datestamp'], 'custom', 'Y-m-d') : NULL;
77  $data['package'] = $info->info['package'];
78  $data['core'] = $info->info['core'];
79  $data['php'] = $info->info['php'];
80  $data['status'] = drush_get_extension_status($info);
81  $data['path'] = drush_extension_get_path($info);
82 
83  return $data;
84 }
85 
86 /**
87  * Return an array with info of a module.
88  */
89 function _drush_pm_info_module($info) {
90  $major_version = drush_drupal_major_version();
91 
92  $data = _drush_pm_info_extension($info);
93  if ($info->schema_version > 0) {
94  $schema_version = $info->schema_version;
95  }
96  elseif ($info->schema_version == -1) {
97  $schema_version = "no schema installed";
98  }
99  else {
100  $schema_version = "module has no schema";
101  }
102  $data['schema_version'] = $schema_version;
103  if ($major_version == 7) {
104  $data['files'] = $info->info['files'];
105  }
106  $data['requires'] = $info->info['dependencies'];
107 
108  if ($major_version == 6) {
109  $requiredby = $info->info['dependents'];
110  }
111  else {
112  $requiredby = array_keys($info->required_by);
113  }
114  $data['required_by'] = $requiredby;
115  if ($info->status == 1) {
116  $role = drush_role_get_class();
117  $data['permissions'] = $role->getModulePerms(drush_extension_get_name($info));
118  }
119  return $data;
120 }
121 
122 /**
123  * Return an array with info of a theme.
124  */
125 function _drush_pm_info_theme($info) {
126  $major_version = drush_drupal_major_version();
127 
128  $data = _drush_pm_info_extension($info);
129 
130  $data['core'] = $info->info['core'];
131  $data['php'] = $info->info['php'];
132  $data['engine'] = $info->info['engine'];
133  $data['base_theme'] = isset($info->base_themes) ? implode($info->base_themes, ', ') : '';
134  $regions = $info->info['regions'];
135  $data['regions'] = $regions;
136  $features = $info->info['features'];
137  $data['features'] = $features;
138  if (count($info->info['stylesheets']) > 0) {
139  $data['stylesheets'] = '';
140  foreach ($info->info['stylesheets'] as $media => $files) {
141  $files = array_keys($files);
142  $data['media '.$media] = $files;
143  }
144  }
145  if (count($info->info['scripts']) > 0) {
146  $scripts = array_keys($info->info['scripts']);
147  $data['scripts'] = $scripts;
148  }
149  return $data;
150 }

File

doxygen/html/info_8pm_8inc_source.html
View source
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Drush: commands/pm/info.pm.inc Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Drush
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.2 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_afac61274991793aa7e9133a8f4f291e.html">commands</a></li><li class="navelem"><a class="el" href="dir_15591510fc66414792ea8adada328324.html">pm</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">info.pm.inc</div>  </div>
</div><!--header-->
<div class="contents">
<a href="info_8pm_8inc.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;&lt;?php</div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * @file</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * pm-info command implementation.</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> * Command callback. Show detailed info for one or more extensions.</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"><a class="code" href="info_8pm_8inc.html#a979f36be571c082a364025ae4bce438b">   11</a></span>&#160;<span class="keyword">function</span> <a class="code" href="info_8pm_8inc.html#a979f36be571c082a364025ae4bce438b">drush_pm_info</a>() {</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;  $result = array();</div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;  $args = <a class="code" href="pm_8drush_8inc.html#a34b2e74a73c176eed08207d9bcb4c587">pm_parse_arguments</a>(func_get_args());</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;  $extension_info = <a class="code" href="includes_2environment_8inc.html#a2f6ea049bc3f5361815aafe6f44a535d">drush_get_extensions</a>(FALSE);</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;  <a class="code" href="pm_8drush_8inc.html#a5f41049d5b474b8d5bbbe9f161ac1c90">_drush_pm_expand_extensions</a>($args, $extension_info);</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;  <span class="comment">// If no extensions are provided, show all.</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;  <span class="keywordflow">if</span> (count($args) == 0) {</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    $args = array_keys($extension_info);</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;  }</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;  <span class="keywordflow">foreach</span> ($args as $extension) {</div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;    <span class="keywordflow">if</span> (isset($extension_info[$extension])) {</div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;      $info = $extension_info[$extension];</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;    }</div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;      <a class="code" href="group__logging.html#gad820f489a93518301794ada4ff7816b6">drush_log</a>(<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;!extension was not found.&#39;</span>, array(<span class="stringliteral">&#39;!extension&#39;</span> =&gt; $extension)), <span class="stringliteral">&#39;warning&#39;</span>);</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;      <span class="keywordflow">continue</span>;</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    }</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="includes_2environment_8inc.html#a5536e4ffcf1cdf1f176e15a3aed81af7">drush_extension_get_type</a>($info) == <span class="stringliteral">&#39;module&#39;</span>) {</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;      $data = <a class="code" href="info_8pm_8inc.html#ad8628d53d40f2db788ec0bec2f9ac62e">_drush_pm_info_module</a>($info);</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;    }</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;      $data = <a class="code" href="info_8pm_8inc.html#ac066152dd0bc2eed6c7284336aebe62e">_drush_pm_info_theme</a>($info);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    }</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    $result[$extension] = $data;</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;  }</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;  <span class="keywordflow">return</span> $result;</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;}</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment"> * Output format formatter-filter callback.</span></div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;<span class="comment"> *</span></div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;<span class="comment"> * @see drush_parse_command()</span></div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;<span class="comment"> * @see drush_outputformat</span></div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00047"></a><span class="lineno"><a class="code" href="info_8pm_8inc.html#a8b95d41afdfc15b0008ea7390e562091">   47</a></span>&#160;<span class="keyword">function</span> <a class="code" href="info_8pm_8inc.html#a8b95d41afdfc15b0008ea7390e562091">_drush_pm_info_format_table_data</a>($data) {</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;  $result = array();</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;  <span class="keywordflow">foreach</span> ($data as $extension =&gt; $info) {</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <span class="keywordflow">foreach</span>($info as $key =&gt; $value) {</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;      <span class="keywordflow">if</span> (is_array($value)) {</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;        <span class="keywordflow">if</span> (empty($value)) {</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;          $value = <span class="stringliteral">&#39;none&#39;</span>;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;        }</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;        <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;          $value = implode(<span class="stringliteral">&#39;, &#39;</span>, $value);</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;        }</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;      }</div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;      $result[$extension][$key] = $value;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    }</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;  }</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;  <span class="keywordflow">return</span> $result;</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;}</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;<span class="comment"> * Return an array with general info of an extension.</span></div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="info_8pm_8inc.html#a0bf627d419ca89d4d9e5f0f3a54e457d">   68</a></span>&#160;<span class="keyword">function</span> <a class="code" href="info_8pm_8inc.html#a0bf627d419ca89d4d9e5f0f3a54e457d">_drush_pm_info_extension</a>($info) {</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;  $data[<span class="stringliteral">&#39;extension&#39;</span>] = <a class="code" href="includes_2environment_8inc.html#a317a284967256e1c0452a13462388c21">drush_extension_get_name</a>($info);</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;  $data[<span class="stringliteral">&#39;project&#39;</span>] = isset($info-&gt;info[<span class="stringliteral">&#39;project&#39;</span>])?$info-&gt;info[<span class="stringliteral">&#39;project&#39;</span>]:<a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;Unknown&#39;</span>);</div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;  $data[<span class="stringliteral">&#39;type&#39;</span>] = <a class="code" href="includes_2environment_8inc.html#a5536e4ffcf1cdf1f176e15a3aed81af7">drush_extension_get_type</a>($info);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;  $data[<span class="stringliteral">&#39;title&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;name&#39;</span>];</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;  $data[<span class="stringliteral">&#39;config&#39;</span>] = isset($info-&gt;info[<span class="stringliteral">&#39;configure&#39;</span>]) ? $info-&gt;info[<span class="stringliteral">&#39;configure&#39;</span>] : <a class="code" href="group__outputfunctions.html#ga1218abcb1e27dd3bb412113d1e344d96">dt</a>(<span class="stringliteral">&#39;None&#39;</span>);</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;  $data[<span class="stringliteral">&#39;description&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;description&#39;</span>];</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;  $data[<span class="stringliteral">&#39;version&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;version&#39;</span>];</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;  $data[<span class="stringliteral">&#39;date&#39;</span>] = isset($info-&gt;info[<span class="stringliteral">&#39;datestamp&#39;</span>]) ? format_date($info-&gt;info[<span class="stringliteral">&#39;datestamp&#39;</span>], <span class="stringliteral">&#39;custom&#39;</span>, <span class="stringliteral">&#39;Y-m-d&#39;</span>) : NULL;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;  $data[<span class="stringliteral">&#39;package&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;package&#39;</span>];</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;  $data[<span class="stringliteral">&#39;core&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;core&#39;</span>];</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;  $data[<span class="stringliteral">&#39;php&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;php&#39;</span>];</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;  $data[<span class="stringliteral">&#39;status&#39;</span>] = <a class="code" href="group__extensions.html#gad7c908db0c414731d0933c93c4b083ea">drush_get_extension_status</a>($info);</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;  $data[<span class="stringliteral">&#39;path&#39;</span>] = <a class="code" href="includes_2environment_8inc.html#a62a951f395505ed28ea3f0a5a108419c">drush_extension_get_path</a>($info);</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;  <span class="keywordflow">return</span> $data;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;}</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;<span class="comment"> * Return an array with info of a module.</span></div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="code" href="info_8pm_8inc.html#ad8628d53d40f2db788ec0bec2f9ac62e">   89</a></span>&#160;<span class="keyword">function</span> <a class="code" href="info_8pm_8inc.html#ad8628d53d40f2db788ec0bec2f9ac62e">_drush_pm_info_module</a>($info) {</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;  $major_version = <a class="code" href="includes_2drupal_8inc.html#ad2ccab77d4bc8e7355186f26cd328ac0">drush_drupal_major_version</a>();</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;  $data = <a class="code" href="info_8pm_8inc.html#a0bf627d419ca89d4d9e5f0f3a54e457d">_drush_pm_info_extension</a>($info);</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  <span class="keywordflow">if</span> ($info-&gt;schema_version &gt; 0) {</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    $schema_version = $info-&gt;schema_version;</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;  }</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;  elseif ($info-&gt;schema_version == -1) {</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    $schema_version = <span class="stringliteral">&quot;no schema installed&quot;</span>;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;  }</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    $schema_version = <span class="stringliteral">&quot;module has no schema&quot;</span>;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;  }</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;  $data[<span class="stringliteral">&#39;schema_version&#39;</span>] = $schema_version;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;  <span class="keywordflow">if</span> ($major_version == 7) {</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    $data[<span class="stringliteral">&#39;files&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;files&#39;</span>];</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;  }</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;  $data[<span class="stringliteral">&#39;requires&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;dependencies&#39;</span>];</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;  <span class="keywordflow">if</span> ($major_version == 6) {</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    $requiredby = $info-&gt;info[<span class="stringliteral">&#39;dependents&#39;</span>];</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;  }</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  <span class="keywordflow">else</span> {</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    $requiredby = array_keys($info-&gt;required_by);</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;  }</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;  $data[<span class="stringliteral">&#39;required_by&#39;</span>] = $requiredby;</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  <span class="keywordflow">if</span> ($info-&gt;status == 1) {</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;    $role = drush_role_get_class();</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    $data[<span class="stringliteral">&#39;permissions&#39;</span>] = $role-&gt;getModulePerms(<a class="code" href="includes_2environment_8inc.html#a317a284967256e1c0452a13462388c21">drush_extension_get_name</a>($info));</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;  }</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  <span class="keywordflow">return</span> $data;</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;}</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="comment">/**</span></div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;<span class="comment"> * Return an array with info of a theme.</span></div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="code" href="info_8pm_8inc.html#ac066152dd0bc2eed6c7284336aebe62e">  125</a></span>&#160;<span class="keyword">function</span> <a class="code" href="info_8pm_8inc.html#ac066152dd0bc2eed6c7284336aebe62e">_drush_pm_info_theme</a>($info) {</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;  $major_version = <a class="code" href="includes_2drupal_8inc.html#ad2ccab77d4bc8e7355186f26cd328ac0">drush_drupal_major_version</a>();</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;  $data = <a class="code" href="info_8pm_8inc.html#a0bf627d419ca89d4d9e5f0f3a54e457d">_drush_pm_info_extension</a>($info);</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;  $data[<span class="stringliteral">&#39;core&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;core&#39;</span>];</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;  $data[<span class="stringliteral">&#39;php&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;php&#39;</span>];</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;  $data[<span class="stringliteral">&#39;engine&#39;</span>] = $info-&gt;info[<span class="stringliteral">&#39;engine&#39;</span>];</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;  $data[<span class="stringliteral">&#39;base_theme&#39;</span>] = isset($info-&gt;base_themes) ? implode($info-&gt;base_themes, <span class="stringliteral">&#39;, &#39;</span>) : <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;  $regions = $info-&gt;info[<span class="stringliteral">&#39;regions&#39;</span>];</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;  $data[<span class="stringliteral">&#39;regions&#39;</span>] = $regions;</div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;  $features = $info-&gt;info[<span class="stringliteral">&#39;features&#39;</span>];</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;  $data[<span class="stringliteral">&#39;features&#39;</span>] = $features;</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;  <span class="keywordflow">if</span> (count($info-&gt;info[<span class="stringliteral">&#39;stylesheets&#39;</span>]) &gt; 0) {</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;    $data[<span class="stringliteral">&#39;stylesheets&#39;</span>] = <span class="stringliteral">&#39;&#39;</span>;</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="keywordflow">foreach</span> ($info-&gt;info[<span class="stringliteral">&#39;stylesheets&#39;</span>] as $media =&gt; $files) {</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;      $files = array_keys($files);</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;      $data[<span class="stringliteral">&#39;media &#39;</span>.$media] = $files;</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    }</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;  }</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;  <span class="keywordflow">if</span> (count($info-&gt;info[<span class="stringliteral">&#39;scripts&#39;</span>]) &gt; 0) {</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    $scripts = array_keys($info-&gt;info[<span class="stringliteral">&#39;scripts&#39;</span>]);</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    $data[<span class="stringliteral">&#39;scripts&#39;</span>] = $scripts;</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;  }</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;  <span class="keywordflow">return</span> $data;</div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Wed Oct 8 2014 09:04:54 for Drush by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.2
</small></address>
</body>
</html>