Skip to content

Instantly share code, notes, and snippets.

View cotto's full-sized avatar

Charis Otto cotto

  • Seattle
  • 23:38 (UTC -07:00)
View GitHub Profile
diff --git a/services.module b/services.module
index 3ab2a2e..f67d990 100644
--- a/services.module
+++ b/services.module
@@ -270,7 +270,8 @@ function services_get_resources($endpoint_name = '') {
$cache_key = 'services:' . $endpoint_name . ':resources';
$resources = array();
- if (($cache = cache_get($cache_key)) && isset($cache->data)) {
+ $disable_cache = variable_get('services_disable_resource_cache', 0);
@cotto
cotto / user_create.php
Created October 31, 2011 18:20
test script to create a user through Drupal's user resource
<?php
$base_url = 'http://YOUR.SITE.HERE/api';
// Login
$login_data = array(
'username' => 'YOUR_USER',
'password' => 'YOUR_PASSWORD',
);
@cotto
cotto / gist:1297070
Created October 18, 2011 23:34
xml request parser for rest server
diff --git a/servers/rest_server/includes/RESTServer.inc b/servers/rest_server/includes/RESTServer.inc
index 63528bc..74bc6b3 100755
--- a/servers/rest_server/includes/RESTServer.inc
+++ b/servers/rest_server/includes/RESTServer.inc
@@ -455,6 +455,26 @@ class RESTServer {
return self::contentFromStream($handle);
}
+ public static function parseXML($handle) {
+ $old_error_state = libxml_use_internal_errors(1);
diff --git a/services.runtime.inc b/services.runtime.inc
index 5c4f1bf..79558b0 100644
--- a/services.runtime.inc
+++ b/services.runtime.inc
@@ -162,12 +162,8 @@ function services_controller_execute($controller, $args = array(), $options = ar
chdir($drupal_path);
}
- // Check if the arguments should be preprocessed.
- if (!empty($controller['endpoint']['preprocess'])) {
diff --git a/resources/user_resource.inc b/resources/user_resource.inc
index e84eb3d..c8a0fb2 100644
--- a/resources/user_resource.inc
+++ b/resources/user_resource.inc
@@ -282,9 +282,11 @@ function _user_resource_update($uid, $account) {
// If a profile category was passed in, use it. Otherwise default
// to 'account' (for saving core user data.)
$category = 'account';
+ $has_category = 0;
if (isset($account['category'])) {
diff --git a/resources/comment_resource.inc b/resources/comment_resource.inc
index 72bd2bd..10071f1 100644
--- a/resources/comment_resource.inc
+++ b/resources/comment_resource.inc
@@ -215,9 +215,7 @@ function _comment_resource_index($page, $fields, $parameters) {
function _comment_resource_create($comment) {
// Adds backwards compatability with regression fixed in #1083242
- if (isset($comment['comment']) && !isset($comment['subject'])) {
- $comment = $comment['comment'];
/**
* Extract arguments for a services method access callback, preserving backwards compatibility with #1083242.
*/
function _services_access_value($data, $fields) {
if (!is_array($fields)) {
$fields = array($fields);
}
diff --git a/services.runtime.inc b/services.runtime.inc
index ec6f801..ccf90c5 100644
--- a/services.runtime.inc
+++ b/services.runtime.inc
@@ -139,6 +139,12 @@ function services_controller_execute($controller, $args = array(), $options = ar
$access_arguments = $args;
}
+ // Load the proper file for the access callback
+ if (!empty($controller['access callback file']) && $access_cb_file = $controller['access callback file']) {
@cotto
cotto / hook.php
Created September 14, 2011 19:51
/**
* implementation of hook_services_resources_alter()
*/
function localnet_services_services_resources_alter(&$resources, &$endpoint) {
// NOTE: services resources are cached. 'services:*' needs to be cleared from cache for this to take effect
#watchdog('res', ppr($resources));
#watchdog('endpt', ppr($endpoint));
if (array_key_exists('node', $resources) && array_key_exists('index', $resources['node'])) {
@cotto
cotto / gist:1198962
Created September 6, 2011 21:04
new parrot change policy
when you want to make a change:
- talk to parrot-dev
- cc perl6-compiler
- drop by #perl6
as you work on your feature
- talk about changes to your plan with Rakudo and Parrot
when your code is ready to merge
- sync with master