{\r
case 'SqlTablePrefix':\r
return 1;\r
+ case 'SqlApi':\r
+ return 1;\r
default:\r
return 0;\r
}\r
<h2>Nucleusテーブルへのアクセス</h2>\r
\r
<p>v2.0まで、Nucleusテーブルへのアクセスは単に<code>nucleus_</code>と名づけられたテーブルに対してSQL命令を実行するだけのものでした。Nucleusのバージョン2.2以降はカスタム・テーブル名を利用できるようになったため、プラグイン開発に若干注意する必要があります。</p>\r
+<p>v3.5でNucleusはPDO等MySQL以外のデータベースハンドラのサポートをするようになりました。この機能はベータ実装ではありますが、プラグイン開発者はデータベースの呼び出しに使用する関数の「sql_*」への書き換えを始めてください。\r
+基本的に、使用している全ての「mysql_*」関数を「sql_*」に置き換える必要があります。たとえば<code>mysql_fetch_assoc($result)</code>は<code>sql_fetch_assoc($result)</code> に置き換えになります。\r
+全ての関数を書き換えたら、Sql APIが無い古いバージョンのNucleusインストールできないように、次に示すコードをプラグイン内に記述して、インストールに必要な最低バージョンを350に指定する必要があります。<br />\r
+<code>function getMinNucleusVersion( return '350';)</code></p>\r
\r
<ol>\r
<li><code>nucleus_item</code> などの固定されたテーブル名の代わりに、テーブル名のプレフィックスを生成するために <code>sql_table('item') </code>というグローバルファンクションを利用します。</li>\r
<li><code>supportsFeature('SqlTablePrefix')</code> が呼ばれたときにプラグインが1(真)を返すようにします。これがないと、カスタムプレフィックスがセットされている場合でバージョンが2.0より大きいNucleusではプラグインをロードできません(用心のため)。</li>\r
+ <li>3.5以降:<code>supportsFeature('SqlApi')</code> が呼ばれたときにプラグインが1(真)を返すようにします。3.5以降のバージョンでは、データベースのバックエンドにmysqlでないものを使用している場合にプラグインをロードできなくなります(用心のため)。</li>\r
</ol>\r
\r
<p class="note">v2.0までのNucleusではグローバルファンクション <code>sql_table</code> は利用できないことに注意してください。もしこのメソッドを用いつつ、プラグインをv2.0以下のNucleusで動作させたい場合は、以下のコードをプラグインクラスの前に追加してください。</p>\r
<li>\r
<strong>Nucleus v3.5 (SVN)</strong>\r
<ul>\r
+ <li>ADD: code to warn if using a non-mysql database handler and a plugin does not supportsFeature 'SqlApi'. (ftruscot)</li>\r
+ <li>CHANGE: set php setting, display_errors, to 0 when not in debug mode to keep users with poorly configured servers from displaying errors on the page. (ftruscot)</li>\r
+ <li>FIX: PHP5.3 warning caused by MANAGER::notify(). See <a href="http://forum.nucleuscms.org/viewtopic.php?t=18997" title="php 5.3 Error">this thread</a>. (ftruscot)</li>\r
<li>FIX: super-admin disallowed from uploading files if not on any teamlists. (ftruscot)</li>\r
<li>ADD: $CONF['ActivationDays'] variable to control days before activation expire. Manually set in config.php if needed (no admin interface). (ftruscot)</li>\r
<li>CHANGE:Notify ITEM link after karma votes(ACTION.php). (shizuki)</li>\r
//
// Please note: if you want to translate this file to your own language, be aware
// that in a next Nucleus version, new variables might be added and some other ones
-// might be deleted. Therefor, it's important to list the Nucleus version for which
+// might be deleted. Therefore, it's important to list the Nucleus version for which
// the file was written in your document.
//
// Fully translated language file can be sent to us and will be made
// Note for English
// This file is ENGLISH Language File for NucleusCMS
-
-
/**
* English Nucleus Language File
*
define('_ARCHIVETYPE_YEAR', 'year');
define('_ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE', 'Newer Version Available');
define('_ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT', 'Upgrade available: v');
+define('_MANAGER_PLUGINSQLAPI_NOTSUPPORT', "Plugin %s was not loaded (does not support SqlApi and you are trying to use a non-mysql db)");
/********************************************
//
// Please note: if you want to translate this file to your own language, be aware
// that in a next Nucleus version, new variables might be added and some other ones
-// might be deleted. Therefor, it's important to list the Nucleus version for which
+// might be deleted. Therefore, it's important to list the Nucleus version for which
// the file was written in your document.
//
// Fully translated language file can be sent to us and will be made
define('_ARCHIVETYPE_YEAR', 'year');
define('_ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE', 'Newer Version Available');
define('_ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT', 'Upgrade available: v');
+define('_MANAGER_PLUGINSQLAPI_NOTSUPPORT', "Plugin %s was not loaded (does not support SqlApi and you are trying to use a non-mysql db)");
/********************************************
define('_ARCHIVETYPE_YEAR', 'ǯ');
define('_ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE', '¿·¤·¤¤¥Ð¡¼¥¸¥ç¥ó¤¬Æþ¼ê²Äǽ¤Ç¤¹');
define('_ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT', '¥¢¥Ã¥×¥°¥ì¡¼¥É¤¬Æþ¼ê²Äǽ¤Ç¤¹¡§ v');
+define('_MANAGER_PLUGINSQLAPI_NOTSUPPORT', "¥×¥é¥°¥¤¥ó %s ¤òÆɤ߹þ¤á¤Þ¤»¤ó¤Ç¤·¤¿¡£(¤³¤Î¥×¥é¥°¥¤¥ó¤ÏSqlAPI¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤Þ¤»¤ó¡£¥Ç¡¼¥¿¥Ù¡¼¥¹¤ÎÀܳÊýË¡¤ò¸«Ä¾¤·¤Æ¤¯¤À¤µ¤¤)");
/********************************************
define('_ARCHIVETYPE_YEAR', '年');
define('_ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE', '新しいバージョンが入手可能です');
define('_ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT', 'アップグレードが入手可能です: v');
+define('_MANAGER_PLUGINSQLAPI_NOTSUPPORT', "プラグイン %s を読み込めませんでした。(このプラグインはSqlAPIをサポートしていません。データベースの接続方法を見直してください)");
/********************************************
return 0;
}
+ // unload plugin if using non-mysql handler and plugin does not support it
+ global $MYSQL_HANDLER;
+ if ((!in_array('mysql',$MYSQL_HANDLER)) && !$this->plugins[$name]->supportsFeature('SqlApi'))
+ {
+ unset($this->plugins[$name]);
+ ACTIONLOG::add(WARNING, sprintf(_MANAGER_PLUGINSQLAPI_NOTSUPPORT, $name));
+ return 0;
+ }
+
// call init method
$this->plugins[$name]->init();
$this->_loadPlugin($listener);
// do notify (if method exists)
if (method_exists($this->plugins[$listener], 'event_' . $eventName))
- call_user_func(array(&$this->plugins[$listener],'event_' . $eventName), $data);
+ call_user_func(array(&$this->plugins[$listener],'event_' . $eventName), &$data);
}
}
}
function doAction($type) { return _ERROR_PLUGIN_NOSUCHACTION; }
function doIf($key,$value) { return false; }
- function doItemVar () {}
+ function doItemVar (&$item) {}
/**
* Checks if a plugin supports a certain feature.
* Name of the feature. See plugin documentation for more info
* 'SqlTablePrefix' -> if the plugin uses the sql_table() method to get table names
* 'HelpPage' -> if the plugin provides a helppage
+ * 'SqlApi' -> if the plugin uses the complete sql_* api (must also require nucleuscms 3.5)
*/
function supportsFeature($feature) {
return 0;
// needed if we include globalfunctions from install.php\r
global $nucleus, $CONF, $DIR_LIBS, $DIR_LANG, $manager, $member;\r
\r
-$nucleus['version'] = 'v3.5SVN';\r
+$nucleus['version'] = 'v3.50SVN';\r
$nucleus['codename'] = '';\r
\r
checkVars(array('nucleus', 'CONF', 'DIR_LIBS', 'MYSQL_HOST', 'MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_DATABASE', 'DIR_LANG', 'DIR_PLUGINS', 'HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_ENV_VARS', 'HTTP_SESSION_VARS', 'HTTP_POST_FILES', 'HTTP_SERVER_VARS', 'GLOBALS', 'argv', 'argc', '_GET', '_POST', '_COOKIE', '_ENV', '_SESSION', '_SERVER', '_FILES'));\r
global $MYSQL_HANDLER;\r
if (!isset($MYSQL_HANDLER))\r
$MYSQL_HANDLER = array('mysql','');\r
+if ($MYSQL_HANDLER[0] == '')\r
+ $MYSQL_HANDLER[0] = 'mysql';\r
include_once($DIR_LIBS . 'sql/'.$MYSQL_HANDLER[0].'.php');\r
// end new for 3.5 sql_* wrapper\r
include_once($DIR_LIBS . 'mysql.php');\r