1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8class Tiki_Profile_InstallHandler_Webservice extends Tiki_Profile_InstallHandler 9{ 10 function getData() 11 { 12 if ($this->data) { 13 return $this->data; 14 } 15 16 $defaults = [ 17 'schema_version' => null, 18 'schema_documentation' => null, 19 ]; 20 21 $data = array_merge($defaults, $this->obj->getData()); 22 23 return $this->data = $data; 24 } 25 26 function canInstall() 27 { 28 $data = $this->getData(); 29 30 if (! isset($data['name'], $data['url'])) { 31 return false; 32 } 33 34 return true; 35 } 36 37 function _install() 38 { 39 global $tikilib; 40 $data = $this->getData(); 41 42 $this->replaceReferences($data); 43 44 require_once 'lib/webservicelib.php'; 45 46 $ws = Tiki_Webservice::create($data['name']); 47 $ws->url = $data['url']; 48 $ws->body = $data['body']; 49 $ws->schemaVersion = $data['schema_version']; 50 $ws->schemaDocumentation = $data['schema_documentation']; 51 $ws->save(); 52 53 return $ws->getName(); 54 } 55} 56