}
public function instance_config_form(&$mform) {
- $soap = class_exists('SoapClient');
- if (!$soap) {
+ if (!class_exists('SoapClient')) {
$mform->addElement('static', null, get_string('notice'), get_string('soapmustbeenabled', 'repository_alfresco'));
+ return false;
}
$mform->addElement('text', 'alfresco_url', get_string('alfresco_url', 'repository_alfresco'), array('size' => '40'));
$mform->addRule('alfresco_url', get_string('required'), 'required', null, 'client');
+ return false;
}
public static function plugin_init() {
if (!class_exists('SoapClient')) {
//only create a new type if it doesn't already exist
$existingtype = $DB->get_record('repository', array('type'=>$this->_typename));
if (!$existingtype) {
+ //run init function
+ if (!repository::static_function($this->_typename, 'plugin_init')) {
+ throw new repository_exception('cannotcreatetype', 'repository');
+ }
+
//create the type
$newtype = new stdclass;
$newtype->type = $this->_typename;
repository::static_function($this->_typename, 'create', $this->_typename, 0, get_system_context(), $instanceoptions);
}
- //run init function
- if (!repository::static_function($this->_typename, 'plugin_init')) {
- throw new repository_exception('cannotcreatetype', 'repository');
- }
-
} else {
throw new repository_exception('existingrepository', 'repository');
}
//check that the plugin exists
$typedirectory = $CFG->dirroot . '/repository/'. $plugin . '/repository.class.php';
if (!file_exists($typedirectory)) {
- throw new repository_exception('invalidplugin', 'repository');
+ //throw new repository_exception('invalidplugin', 'repository');
+ return false;
}
$pname = null;
* function which is run when the type is created (moodle administrator add the plugin)
* @return boolean success or fail?
*/
- public static function plugin_init(){
+ public static function plugin_init() {
return true;
}