Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
Merge pull request #22 from jamiesnape/FixesAndFormatting
Browse files Browse the repository at this point in the history
Various fixes, formatting, and testing and compatibility enhancements
  • Loading branch information
cpatrick committed Jun 16, 2014
2 parents 36eb74e + e7d5114 commit 3fcfffa
Show file tree
Hide file tree
Showing 3,261 changed files with 23,235 additions and 18,020 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
language: php

php:
- 5.4
- 5.5
- 5.6

before_script:
- cp tests/travis/mysql.ini tests/configs/mysql.ini && cp tests/travis/pgsql.ini tests/configs/pgsql.ini
- mysql -u root -e 'create database midas_test;'
- psql -U postgres -c 'create database midas_test;'

script:
- mkdir _test && cd _test
- cmake ..
- ctest -j2 -V .
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
#=============================================================================
# MIDAS Server
# Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
# All rights reserved.
# More information http://www.kitware.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

project( Midas )

#-----------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIDAS Server
Copyright (c) Kitware SAS. 20 rue de la Villette. 69328 Lyon, FRANCE
All rights reserved.
More information http://www.kitware.com
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
25 changes: 19 additions & 6 deletions CTestConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
## This file should be placed in the root directory of your project.
## Then modify the CMakeLists.txt file in the root directory of your
## project to incorporate the testing dashboard.
## # The following are required to uses Dart and the Cdash dashboard
## ENABLE_TESTING()
## INCLUDE(CTest)
#=============================================================================
# MIDAS Server
# Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
# All rights reserved.
# More information http://www.kitware.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0.txt
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#=============================================================================

set(CTEST_PROJECT_NAME "Midas")
set(CTEST_NIGHTLY_START_TIME "19:00:00 EST")

Expand Down
26 changes: 13 additions & 13 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
MIDAS Server
Copyright (c) Kitware SAS. 20 rue de la Villette. 69328 Lyon, FRANCE
All rights reserved.
More information http://www.kitware.com
MIDAS Server
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0.txt
http://www.apache.org/licenses/LICENSE-2.0.txt

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Midas Platform
==============

![Midas Platform](https://raw.githubusercontent.com/midasplatform/Midas/master/core/public/images/midas-200.png)

_Version 3.x_

[![Build Status](https://travis-ci.org/midasplatform/Midas.png?branch=master)](https://travis-ci.org/midasplatform/Midas)

Midas Platform is an open-source toolkit that enables the rapid creation of
tailored, web-enabled data storage. Designed to meet the needs of advanced
data-centric computing, Midas Platform addresses the growing challenge of large
data by providing a flexible, intelligent data storage system. The system
integrates multimedia server technology with other open-source data analysis and
visualization tools to enable data-intensive applications that easily interface
with existing workflows.

<http://www.midasplatform.org/>
1 change: 0 additions & 1 deletion README.txt

This file was deleted.

75 changes: 36 additions & 39 deletions core/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
/** Web Api Controller */
class ApiController extends REST_Controller
{

private $httpSuccessCode = array(
'index' => 200, // 200 OK
'get' => 200,
Expand Down Expand Up @@ -51,7 +50,7 @@ protected function _exceptionHandler(Exception $e)
{
$errorInfo['code'] = $e->getCode();
$errorInfo['msg'] = $e->getMessage();
switch ($errorInfo['code'])
switch($errorInfo['code'])
{
case MIDAS_INVALID_PARAMETER:
case MIDAS_INVALID_POLICY:
Expand All @@ -73,7 +72,7 @@ protected function _exceptionHandler(Exception $e)
default:
$httpCode = 400; // 400 Bad Request
}
return array($errorInfo, $httpCode);
return array($errorInfo, $httpCode);
}

/**
Expand Down Expand Up @@ -104,49 +103,49 @@ protected function _exceptionHandler(Exception $e)
* for given url: {base_path}/rest/item/duplicate/2, Midas will call
* 'itemDuplicate' in ApiComponent (in core module) to do the api;
*/

protected function _genericAction($args, $resource, $restAction, $apiFunctions, $moduleName = null)
{
$ApiComponent = MidasLoader::loadComponent('Api'.$resource, $moduleName);
$httpCode = $this->httpSuccessCode[strtolower($restAction)];
$calledFunction = $apiFunctions['default'];
$apiResults = array();
try
$ApiComponent = MidasLoader::loadComponent('Api'.$resource, $moduleName);
$httpCode = $this->httpSuccessCode[strtolower($restAction)];
$calledFunction = $apiFunctions['default'];
$apiResults = array();
try
{
$userDao = $this->_getUser($args);
if(isset($args['method']))
{
$userDao = $this->_getUser($args);
if(isset($args['method']))
$method = strtolower($args['method']);
if(array_key_exists($method, $apiFunctions))
{
$method = strtolower($args['method']);
if(array_key_exists($method, $apiFunctions))
{
$calledFunction = $apiFunctions[$method];
}
else
{
throw new Exception('Server error. Operation ' . $args['method'] . ' is not supported.', -100);
}
}
if(method_exists($ApiComponent, $calledFunction . 'Wrapper')) {
$calledFunction = $calledFunction . 'Wrapper';
}
$resultsArray = $ApiComponent->$calledFunction($args, $userDao);
if (isset($resultsArray))
{
$apiResults['data'] = $resultsArray;
$calledFunction = $apiFunctions[$method];
}
else // if the api function doesn't provide an return value
else
{
$apiResults['msg'] = "succeed!"; // there is no exception if code reaches here
throw new Exception('Server error. Operation ' . $args['method'] . ' is not supported.', -100);
}
}
catch (Exception $e)
if(method_exists($ApiComponent, $calledFunction . 'Wrapper'))
{
$calledFunction = $calledFunction . 'Wrapper';
}
$resultsArray = $ApiComponent->$calledFunction($args, $userDao);
if(isset($resultsArray))
{
$apiResults['data'] = $resultsArray;
}
else // if the api function doesn't provide an return value
{
list($apiResults['error'], $httpCode) = $this->_exceptionHandler($e);
$apiResults['msg'] = "succeed!"; // there is no exception if code reaches here
}
$this->_response->setHttpResponseCode($httpCode);
// only the data assigned to '$this->view->apiresults' will be serilized
// in requested format (json, xml, etc) and filled in response body
$this->view->apiresults = $apiResults;
}
catch(Exception $e)
{
list($apiResults['error'], $httpCode) = $this->_exceptionHandler($e);
}
$this->_response->setHttpResponseCode($httpCode);
// only the data assigned to '$this->view->apiresults' will be serilized
// in requested format (json, xml, etc) and filled in response body
$this->view->apiresults = $apiResults;
}

/**
Expand Down Expand Up @@ -215,6 +214,4 @@ public function optionsAction()
{
$this->_response->setHeader('Allow', 'OPTIONS');
}

} //end class
?>
}
4 changes: 1 addition & 3 deletions core/AppComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,4 @@
*/
class AppComponent extends MIDAS_GlobalComponent
{


}
}
4 changes: 2 additions & 2 deletions core/AppController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function preDispatch()
$user->setExpirationSeconds(60 * Zend_Registry::get('configGlobal')->session->lifetime);
}

if($user->Dao == null)
if($user->Dao == null && $fc->getRequest()->getControllerName() != 'install')
{
$userModel = MidasLoader::loadModel('User');
$cookieData = $this->getRequest()->getCookie('midasUtil');
Expand Down Expand Up @@ -668,4 +668,4 @@ protected function t($text)
var $Setting;

/**end completion eclipse */
}//end class
} // end class
7 changes: 3 additions & 4 deletions core/AppForm.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*=========================================================================
MIDAS Server
Copyright (c) Kitware SAS. 20 rue de la Villette. 69328 Lyon, FRANCE
Copyright (c) Kitware SAS. 26 rue Louis Guérin. 69100 Villeurbanne, FRANCE
All rights reserved.
More information http://www.kitware.com
Expand All @@ -28,11 +28,10 @@ public function __construct()
$this->webroot = $fc->getBaseUrl();
}//end construct


/** translation */
protected function t($text)
protected function t($text)
{
Zend_Loader::loadClass("InternationalizationComponent", BASE_PATH.'/core/controllers/components');
return InternationalizationComponent::translate($text);
}//en method t
}//end class
} // end class
9 changes: 3 additions & 6 deletions core/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ protected function _initDoctype()
$view->doctype('XHTML1_STRICT');
}//end _initDoctype


/**
* \fn protected _initConfig()
* \brief set the configuration and save it in the registry
Expand Down Expand Up @@ -110,7 +109,7 @@ protected function _initConfig()
Zend_Db_Table::setDefaultAdapter($db);
Zend_Registry::set('dbAdapter', $db);
}
elseif($configDatabase->database->type == 'mongo')
else if($configDatabase->database->type == 'mongo')
{
// The mongo driver should be a php extension
$db = new Mongo($configDatabase->database->params->host.":".
Expand All @@ -133,7 +132,6 @@ protected function _initConfig()
'message' => 'message',
'datetime' => 'timestamp',
'module' => 'module');
$writerDb = new Zend_Log_Writer_Db($db, 'errorlog', $columnMapping);
if($configGlobal->environment == 'production')
{
$formatter = new Zend_Log_Formatter_Simple();
Expand Down Expand Up @@ -162,6 +160,7 @@ protected function _initConfig()
if($configDatabase->database->adapter == 'PDO_MYSQL'
&& $configDatabase->database->params->password != 'set_your_password')
{
$writerDb = new Zend_Log_Writer_Db($db, 'errorlog', $columnMapping);
$logger->addWriter($writerDb);
$logger->setEventItem('datetime', date('Y-m-d H:i:s'));
$logger->setEventItem('module', 'unknown');
Expand Down Expand Up @@ -218,7 +217,7 @@ protected function _initRouter()
$apiModules[] = $key;
}
}
elseif($module == 1 && file_exists(BASE_PATH.'/privateModules/'.$key) && file_exists(BASE_PATH . "/privateModules/".$key."/AppController.php"))
else if($module == 1 && file_exists(BASE_PATH.'/privateModules/'.$key) && file_exists(BASE_PATH . "/privateModules/".$key."/AppController.php"))
{
$listeModule[] = $key;
// get WebApi controller directories and WebApi module names for enabled modules
Expand Down Expand Up @@ -333,6 +332,4 @@ protected function _initREST()
$restContexts = new REST_Controller_Action_Helper_RestContexts();
Zend_Controller_Action_HelperBroker::addHelper($restContexts);
}

}

4 changes: 2 additions & 2 deletions core/ComponentLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function loadComponents($components, $module = '')
{
$this->loadComponent($components, $module);
}
elseif(is_array($components))
else if(is_array($components))
{
foreach($components as $component)
{
Expand Down Expand Up @@ -62,7 +62,7 @@ public function loadComponent($component, $module = '')
{
include_once BASE_PATH.'/modules/'.$module.'/controllers/components/'.$component.'Component.php';
}
elseif(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
else if(file_exists(BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php'))
{
include_once BASE_PATH.'/privateModules/'.$module.'/controllers/components/'.$component.'Component.php';
}
Expand Down
4 changes: 2 additions & 2 deletions core/GlobalComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Provides global function to the components
*/
class MIDAS_GlobalComponent extends Zend_Controller_Action_Helper_Abstract
{
{
/**
* Get Logger
* @return Zend_Log
Expand All @@ -32,4 +32,4 @@ public function getLogger()
{
return Zend_Registry::get('logger');
}
} // end class
} // end class
Loading

0 comments on commit 3fcfffa

Please sign in to comment.