/** * Stores a web service in the database. * * @param WebService $webService * * @return bool * <true>, if successful * <false>, otherwise * */ public function storeWS(WebService &$webService) { $db =& wfGetDB(DB_MASTER); try { $db->replace($db->tableName('smw_ws_wwsd'), null, array('web_service_id' => $webService->getArticleID(), 'uri' => $webService->getURI(), 'protocol' => $webService->getProtocol(), 'method' => $webService->getMethod(), 'parameters' => $webService->getParameters(), 'result' => $webService->getResult(), 'display_policy' => $webService->getDisplayPolicy(), 'query_policy' => $webService->getQueryPolicy(), 'update_delay' => $webService->getUpdateDelay(), 'span_of_life' => $webService->getSpanOfLife(), 'expires_after_update' => $webService->doesExpireAfterUpdate() == "true" ? 'true' : 'false', 'confirmed' => $webService->getConfirmationStatus(), 'authentication_type' => $webService->getAuthenticationType(), 'authentication_login' => $webService->getAuthenticationLogin(), 'authentication_password' => $webService->getAuthenticationPassword())); } catch (Exception $e) { $temp = $e->getMessage(); $this->{$temp}(); echo $e->getMessage(); return false; } return true; }
/** * this method checks if a wwsd was deleted or modified * and therefore has to be removed from the database * * @param WebService $mNewWebService * @return boolean */ public static function detectModifiedWWSD($mNewWebService) { if (self::$mOldWebservice) { if (!$mNewWebService) { return true; } $remove = false; if (self::$mOldWebservice->getArticleID() != $mNewWebService->getArticleID()) { $remove = true; } else { if (self::$mOldWebservice->getMethod() != $mNewWebService->getMethod()) { $remove = true; } else { if (self::$mOldWebservice->getParameters() != $mNewWebService->getParameters()) { $remove = true; } else { if (self::$mOldWebservice->getProtocol() != $mNewWebService->getProtocol()) { $remove = true; } else { if (self::$mOldWebservice->getResult() != $mNewWebService->getResult()) { $remove = true; } else { if (self::$mOldWebservice->getURI() != $mNewWebService->getURI()) { $remove = true; } } } } } } return $remove; } return false; }