/[drupal]/contributions/modules/plugin_manager/plugin_manager.admin.inc
ViewVC logotype

Diff of /contributions/modules/plugin_manager/plugin_manager.admin.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.52.2.30, Sun Sep 28 15:03:48 2008 UTC revision 1.52.2.31, Wed Oct 1 01:15:47 2008 UTC
# Line 167  function plugin_manager_browse_form_subm Line 167  function plugin_manager_browse_form_subm
167    drupal_set_message(t("The queue has been updated. ") . l(t('Click Here to install your queued plugins.'), 'admin/plugin_manager/install'));    drupal_set_message(t("The queue has been updated. ") . l(t('Click Here to install your queued plugins.'), 'admin/plugin_manager/install'));
168  }  }
169    
170    
171    /**
172     * FAPI callback for the manual plugin manager installer.
173     */
174    function plugin_manager_manual($form_state) {
175      drupal_set_message(t('WARNING: This manual install page is to be used with great caution. *Always* inspect an archive before you upload it to your site if you are unsure of the source. It is suggested that you not use this page during normal operations, but use instead the ').l('regular install page','admin/plugin_manager/install'),'error');
176      drupal_set_title('Manual Install');
177      $form['#attributes'] = array('enctype' => "multipart/form-data");
178      $form['tarball'] = array(
179        '#type' => 'file',
180        '#title' => t('Plugin Tarball'),
181      );
182      $form['backend'] = array(
183        '#title' => t('Installation method'),
184        '#type' => 'select',
185        '#options' => plugin_manager_backends(),
186      );
187      $form['host'] = array(
188        '#title' => t('Hostname'),
189        '#type' => 'textfield',
190        '#default_value' => variable_get('plugin_manager_hostname', 'localhost'),
191      );
192      $form['username'] = array(
193        '#type' => 'textfield',
194        '#title' => t('FTP Username'),
195        '#description' => t('Username for the local ftp user.'),
196        '#default_value' => variable_get('plugin_manager_username',''),
197      );
198      $form['password'] = array(
199        '#type' => 'password',
200        '#title' => t('FTP Password'),
201        '#description' => t('Password for the ftp user.'),
202        '#default_value' => '',
203      );
204      $form['type'] = array(
205        '#type' => 'select',
206        '#title' => t('Type'),
207        '#default_value' => 'modules',
208        '#options' => array('themes' => 'Theme', 'modules' => 'Module'),
209        '#description' => t('This lets the system know where to install the plugin.'),
210      );
211      $form['submit'] = array(
212        '#type' => 'submit',
213        '#value' => t('Install'),
214      );
215    
216      return $form;
217    }
218    
219    /**
220     * Submit callback for plugin_manager_manual().
221     */
222    function plugin_manager_manual_submit($form, &$form_state) {
223      $backend_list = plugin_manager_backends();
224      $backend = $backend_list[$form_state['values']['backend']];
225      $file = file_save_upload('tarball');
226      $host = $form_state['values']['host'];
227      $user = $form_state['values']['username'];
228      $pass = $form_state['values']['password'];
229      $type = $form_state['values']['type'];
230    
231      // Get the file
232      if (!$file) {
233        drupal_set_message(t('File could not be uploaded.'), 'error');
234        return;
235      }
236    
237      // Then finally install it.
238      $files = plugin_manager_untar($file->filepath);
239      //plugin_manager_ftp_copy($extracted, $type, $host, $user, $pass);
240    
241      // Copy the extracted files
242      $copy = call_user_func_array($backend .'_plugin_manager_copy',
243        array($files, $type, $host,
244        $user, $pass));
245    
246      // If it failed, stop now.
247      if (!$copy) {
248        drupal_set_message(t("Unable to install ") . $name, 'error');
249        return;
250        }
251    
252      foreach (array_reverse($files) AS $file) {
253        // Mark files as installed
254        if ($copy) {
255        db_query("INSERT INTO {plugin_manager_files} VALUES('%s', '%s')",
256            $name, $type .'/'. $file);
257        }
258    
259        // Remove the extracted files.
260        $file = file_directory_path() .'/plugin_manager_extraction/'. $file;
261        if (is_dir($file)) {
262        rmdir($file);
263        }
264        else {
265        unlink($file);
266        }
267      }
268    
269      drupal_set_message(t("Successfully installed plugin."). l('Go Here','admin/build/'.strtolower($type)).t(' to enable it.'));
270    }
271    
272    
273  /**  /**
274   * FAPI for the first page of the installer   * FAPI for the first page of the installer
275   *   *
# Line 193  function plugin_manager_page_1() { Line 296  function plugin_manager_page_1() {
296    return $form;    return $form;
297  }  }
298    
299    
300  /**  /**
301   * FAPI for the second page of the installer   * FAPI for the second page of the installer
302   *   *

Legend:
Removed from v.1.52.2.30  
changed lines
  Added in v.1.52.2.31

  ViewVC Help
Powered by ViewVC 1.1.2