本文整理汇总了PHP中POD::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP POD::execute方法的具体用法?PHP POD::execute怎么用?PHP POD::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类POD
的用法示例。
在下文中一共展示了POD::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: removeServiceSetting
function removeServiceSetting($name, $pruneSimilarEntries = false)
{
global $database;
clearServiceSettingCache();
if ($pruneSimilarEntries) {
return POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name like '" . POD::escapeString($name) . "'");
} else {
return POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name = '" . POD::escapeString($name) . "'");
}
}
示例2: removeAll
function removeAll($removeAttachments = true)
{
global $database;
$blogid = getBlogId();
$tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
POD::query("UPDATE {$database['prefix']}BlogStatistics SET visits = 0 WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}CommentsNotified WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}LinkCategories WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
//POD::query("DELETE FROM {$database['prefix']}UserSettings WHERE user = $blogid");
POD::query("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
POD::query("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid} AND id <> 0");
if (count($tags) > 0) {
$tagliststr = implode(', ', $tags);
$nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
if (count($nottargets) > 0) {
$nottargetstr = implode(', ', $nottargets);
POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
} else {
POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) ");
}
}
if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
}
if ($removeAttachments) {
Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
POD::query("UPDATE {$database['prefix']}BlogSettings SET logo = '' WHERE blogid = {$blogid}");
}
}
示例3: clearCache
function clearCache()
{
global $database, $changed, $errorlog, $memcache;
static $isCleared = false;
if ($isCleared == true) {
return;
}
if (!is_null($blogids = POD::queryColumn("SELECT blogid FROM {$database['prefix']}PageCacheLog"))) {
$changed = true;
$errorlog = false;
echo '<li>', _textf('페이지 캐시를 초기화합니다.'), ': ';
foreach ($blogids as $ids) {
if (CacheControl::flushAll($ids) == false) {
$errorlog = true;
}
}
if ($errorlog == false) {
echo '<span class="result success">', _text('성공'), '</span></li>';
} else {
echo '<span class="result fail">', _text('실패'), '</span></li>';
}
}
if (!is_null($memcache)) {
echo '<li>', _textf('Memcached 캐시를 초기화합니다.'), ': ';
if ($memcache->flush()) {
echo '<span class="result success">', _text('성공'), '</span></li>';
} else {
echo '<span class="result fail">', _text('실패'), '</span></li>';
}
}
echo '<li>', _textf('공지사항 캐시를 초기화합니다.'), ': ';
if (POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name like 'TextcubeNotice%'")) {
echo '<span class="result success">', _text('성공'), '</span></li>';
} else {
echo '<span class="result fail">', _text('실패'), '</span></li>';
}
$isCleared = true;
}
示例4: treatPluginTable
function treatPluginTable($plugin, $name, $fields, $keys, $version)
{
$context = Model_Context::getInstance();
// global $context;
if (doesExistTable($context->getProperty('database.prefix') . $name)) {
$keyname = 'Database_' . $name;
$value = $plugin;
$result = Setting::getServiceSetting($keyname, null, true);
if (is_null($result)) {
$keyname = Utils_Unicode::lessenAsEncoding($keyname, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
$query = DBModel::getInstance();
$query->reset('ServiceSettings');
$query->setAttribute('name', $keyname, true);
$query->setAttribute('value', $value, true);
$query->insert();
} else {
$keyname = Utils_Unicode::lessenAsEncoding($keyname, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
$values = explode('/', $result, 2);
if (strcmp($plugin, $values[0]) != 0) {
// diff plugin
return false;
// nothing can be done
} else {
if (strcmp($version, $values[1]) != 0) {
$query = DBModel::getInstance();
$query->reset('ServiceSettings');
$query->setQualifier('name', 'equals', $keyname, true);
$query->setAttribute('value', $value, true);
$query->update();
$eventName = 'UpdateDB_' . $name;
fireEvent($eventName, $values[1]);
}
}
}
return true;
} else {
$query = "CREATE TABLE " . $context->getProperty('database.prefix') . $name . " (blogid int(11) NOT NULL default 0,";
$isaiExists = false;
$index = '';
foreach ($fields as $field) {
$ai = '';
if (strtolower($field['attribute']) == 'int' || strtolower($field['attribute']) == 'mediumint') {
if ($field['autoincrement'] == 1 && !$isaiExists) {
$ai = ' AUTO_INCREMENT ';
$isaiExists = true;
if (!in_array($field['name'], $keys)) {
$index = ", KEY({$field['name']})";
}
}
}
$isNull = $field['isnull'] == 0 ? ' NOT NULL ' : ' NULL ';
$defaultValue = is_null($field['default']) ? '' : " DEFAULT '" . POD::escapeString($field['default']) . "' ";
$fieldLength = $field['length'] >= 0 ? "(" . $field['length'] . ")" : '';
$sentence = $field['name'] . " " . $field['attribute'] . $fieldLength . $isNull . $defaultValue . $ai . ",";
$query .= $sentence;
}
array_unshift($keys, 'blogid');
$query .= " PRIMARY KEY (" . implode(',', $keys) . ")";
$query .= $index;
$query .= ") TYPE=MyISAM ";
$query .= POD::charset() == 'utf8' ? 'DEFAULT CHARSET=utf8' : '';
if (POD::execute($query)) {
$keyname = Utils_Unicode::lessenAsEncoding('Database_' . $name, 32);
$value = Utils_Unicode::lessenAsEncoding($plugin . '/' . $version, 255);
Setting::setServiceSetting($keyname, $value, true);
#POD::execute("INSERT INTO {$database['prefix']}ServiceSettings SET name='$keyname', value ='$value'");
return true;
} else {
return false;
}
}
return true;
}
示例5: clearCache
function clearCache()
{
global $database, $changed, $errorlog, $memcache;
static $isCleared = false;
$context = Model_Context::getInstance();
if ($isCleared == true) {
return;
}
if (!is_null($blogids = POD::queryColumn("SELECT blogid FROM {$database['prefix']}PageCacheLog"))) {
$changed = true;
$errorlog = false;
echo '<li>', _textf('페이지 캐시를 초기화합니다.'), ': ';
foreach ($blogids as $ids) {
if (CacheControl::flushAll($ids) == false) {
$errorlog = true;
}
}
if ($errorlog == false) {
echo '<span class="result success">', _text('성공'), '</span></li>';
} else {
echo '<span class="result fail">', _text('실패'), '</span></li>';
}
}
if ($context->getProperty('service.codecache', false)) {
$changed = true;
$errorlog = false;
echo '<li>', _textf('코드 캐시를 초기화합니다.'), ': ';
$code = new CodeCache();
$code->flush();
if ($errorlog == false) {
echo '<span class="result success">', _text('성공'), '</span></li>';
} else {
echo '<span class="result fail">', _text('실패'), '</span></li>';
}
}
if (!is_null($memcache)) {
echo '<li>', _textf('Memcached 캐시를 초기화합니다.'), ': ';
if ($memcache->flush()) {
echo '<span class="result success">', _text('성공'), '</span></li>';
} else {
echo '<span class="result fail">', _text('실패'), '</span></li>';
}
}
echo '<li>', _textf('공지사항 캐시를 초기화합니다.'), ': ';
if (POD::execute("DELETE FROM {$database['prefix']}ServiceSettings WHERE name like 'TextcubeNotice%'")) {
echo '<span class="result success">', _text('성공'), '</span></li>';
} else {
echo '<span class="result fail">', _text('실패'), '</span></li>';
}
if (!is_null($blogids = POD::queryColumn("SELECT DISTINCT blogid FROM {$database['prefix']}BlogSettings"))) {
$changed = true;
$errorlog = false;
echo '<li>', _textf('댓글 및 트랙백 휴지통을 비웁니다.'), ': ';
foreach ($blogids as $ids) {
emptyTrash(true, $ids);
emptyTrash(false, $ids);
}
if ($errorlog == false) {
echo '<span class="result success">', _text('성공'), '</span></li>';
} else {
echo '<span class="result fail">', _text('실패'), '</span></li>';
}
}
$isCleared = true;
}
示例6: requireStrictRoute
<?php
/// Copyright (c) 2004-2015, Needlworks / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
if (!array_key_exists('viewMode', $_REQUEST)) {
$_REQUEST['viewMode'] = '';
} else {
$_REQUEST['viewMode'] = '?' . $_REQUEST['viewMode'];
}
POD::execute("DELETE FROM `{$database['prefix']}BlogSettings` WHERE `blogid` = {$blogid} AND `name` = 'coverpageOrder'");
header('Location: ' . $context->getProperty('uri.blog') . '/owner/skin/coverpage' . $_REQUEST['viewMode']);
示例7: removePageCacheLog
function removePageCacheLog()
{
global $database;
if (empty($this->queryHash)) {
$this->getQueryHash();
}
return POD::execute("DELETE FROM {$database['prefix']}PageCacheLog \n\t\t\tWHERE blogid = " . getBlogId() . "\n\t\t\tAND name = '" . POD::escapeString($this->queryHash) . "'");
}
示例8: removeBlog
function removeBlog($blogid)
{
$pool = DBModel::getInstance();
$ctx = Model_Context::getInstance();
if (Setting::getServiceSetting("defaultBlogId", 1, true) == $blogid) {
return false;
}
$targets = array('Attachments', 'BlogSettings', 'BlogStatistics', 'Categories', 'Comments', 'CommentsNotified', 'CommentsNotifiedQueue', 'DailyStatistics', 'Entries', 'EntriesArchive', 'FeedGroups', 'FeedReads', 'FeedStarred', 'FeedSettings', 'Filters', 'Links', 'LinkCategories', 'PageCacheLog', 'Plugins', 'RefererLogs', 'RefererStatistics', 'RemoteResponses', 'RemoteResponseLogs', 'SkinSettings', 'TagRelations', 'Privileges', 'XMLRPCPingSettings');
//Clear Tables
foreach ($targets as $t) {
$pool->reset($t);
$pool->setQualifier('blogid', 'eq', $blogid);
$pool->delete();
}
//Delete Tags
$tags = POD::queryColumn("SELECT DISTINCT tag FROM " . $ctx->getProperty('database.prefix') . "TagRelations WHERE blogid = {$blogid}");
if (count($tags) > 0) {
$tagliststr = implode(', ', $tags);
// Tag id used at deleted blog.
$nottargets = POD::queryColumn("SELECT DISTINCT tag FROM " . $ctx->getProperty('database.prefix') . "TagRelations WHERE tag in ( {$tagliststr} )");
// Tag id used at other blogs.
if (count($nottargets) > 0) {
$nottargetstr = implode(', ', $nottargets);
POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
} else {
POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "Tags WHERE id IN ( {$tagliststr} ) ");
}
}
//Delete Feeds
$feeds = POD::queryColumn("SELECT DISTINCT feeds FROM " . $ctx->getProperty('database.prefix') . "FeedGroupRelations WHERE blogid = {$blogid}");
if (count($feeds) > 0) {
foreach ($feeds as $feedId) {
deleteFeed($blogid, $feedId);
}
}
//Clear Plugin Database
// TODO : encapsulate with 'value'
$query = "SELECT name, value FROM " . $ctx->getProperty('database.prefix') . "ServiceSettings WHERE name like 'Database\\_%'";
$plugintablesraw = POD::queryAll($query);
foreach ($plugintablesraw as $table) {
$dbname = $ctx->getProperty('database.prefix') . substr($table['name'], 9);
POD::execute("DELETE FROM " . $ctx->getProperty('database.prefix') . "{$dbname} WHERE blogid = {$blogid}");
}
//Clear RSS Cache
if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
}
//Delete Attachments
Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
return true;
}
示例9: deleteTagsWithEntryId
function deleteTagsWithEntryId($blogid, $entry)
{
global $database;
$taglist = POD::queryColumn("SELECT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid} AND entry = {$entry}");
if (!is_null($taglist)) {
$tagliststr = implode(',', $taglist);
foreach ($taglist as $tagid) {
CacheControl::flushTag($tagid);
}
POD::execute("DELETE FROM {$database['prefix']}TagRelations\n\t\t\t\tWHERE blogid = {$blogid} AND entry = {$entry}");
$nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
if (count($nottargets) > 0) {
$nottargetstr = implode(', ', $nottargets);
POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
} else {
POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} )");
}
}
}
示例10: DBQuery
private static function DBQuery($mode = 'query', $sql)
{
switch ($mode) {
case 'cell':
return POD::queryCell($sql);
case 'row':
return POD::queryRow($sql);
case 'execute':
return POD::execute($sql);
case 'count':
return POD::queryCount($sql);
case 'all':
return POD::queryAll($sql);
case 'query':
default:
return POD::query($sql);
}
return null;
}
示例11: foreach
POD::execute($query);
}
$result = true;
foreach ($plugintables as $dbname) {
$query = "DROP TABLE {$dbname}";
$result = POD::execute($query) && $result;
}
deactivatePlugin($pluginname);
if ($result == false) {
Respond::ResultPage(1);
exit;
}
} else {
// type 2, table
$dbname = $_REQUEST['name'];
if (strncmp($dbname, $database['prefix'], strlen($database['prefix'])) != 0) {
Respond::ResultPage(1);
exit;
}
if (in_array($dbname, $definedTables)) {
Respond::ResultPage(1);
exit;
}
if (!doesExistTable($dbname)) {
Respond::ResultPage(1);
exit;
}
$query = "DROP TABLE {$dbname}";
POD::execute($query);
}
Respond::ResultPage(0);
示例12: add
function add()
{
global $database;
if (!isset($this->id)) {
$this->id = $this->nextId();
} else {
$this->id = $this->nextId($this->id);
}
if (!isset($this->entry)) {
return $this->_error('entry');
}
if (!isset($this->commenter) && !isset($this->name)) {
return $this->_error('commenter');
}
if (!isset($this->content)) {
return $this->_error('content');
}
if (!isset($this->ip)) {
$this->ip = $_SERVER['REMOTE_ADDR'];
}
if (!isset($this->isfiltered)) {
$this->isfiltered = 0;
}
// legacy
if (isset($this->commenter)) {
$this->replier = $this->commenter;
/*unset($this->commenter);*/
}
if (!($query = $this->_buildQuery())) {
return false;
}
if (!$query->hasAttribute('written')) {
$query->setAttribute('written', Timestamp::getUNIXtime());
}
if (!$query->insert()) {
return $this->_error('insert');
}
if (isset($this->parent)) {
$this->entry = Comment::getEntry($this->parent);
}
if (isset($this->entry) && $this->isfiltered == 0) {
POD::execute("UPDATE {$database['prefix']}Entries SET comments = comments + 1 WHERE blogid = " . getBlogId() . " AND id = {$this->entry}");
}
return true;
}
示例13: getDeleteAttachment
function getDeleteAttachment($filename)
{
global $database, $serviceURL;
$tmpImage = POD::queryCell("SELECT image FROM {$database['prefix']}TeamUserSettings WHERE blogid=" . getBlogId() . " and userid=" . getUserId());
if ($tmpImage) {
POD::execute("UPDATE {$database['prefix']}TeamUserSettings SET image='', updated=UNIX_TIMESTAMP() WHERE blogid=" . getBlogId() . " and userid=" . getUserId());
@unlink(__TEXTCUBE_ATTACH_DIR__ . "/" . getBlogId() . "/team/" . $tmpImage);
}
$result = "{$serviceURL}/resources/image/spacer.gif";
return $result;
}
示例14: removeBlog
function removeBlog($blogid)
{
global $database;
if (getServiceSetting("defaultBlogId", 1) == $blogid) {
return false;
}
$tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
$feeds = POD::queryColumn("SELECT DISTINCT feeds FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
//Clear Tables
POD::execute("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}BlogSettings WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}BlogStatistics WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}CommentsNotified WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}EntriesArchive WHERE blogid = {$blogid}");
// POD::execute("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = $blogid");
POD::execute("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}FeedSettings WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}LinkCategories WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}PageCacheLog WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}SkinSettings WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}Privileges WHERE blogid = {$blogid}");
POD::execute("DELETE FROM {$database['prefix']}XMLRPCPingSettings WHERE blogid = {$blogid}");
//Delete Tags
if (count($tags) > 0) {
$tagliststr = implode(', ', $tags);
// Tag id used at deleted blog.
$nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
// Tag id used at other blogs.
if (count($nottargets) > 0) {
$nottargetstr = implode(', ', $nottargets);
POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
} else {
POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) ");
}
}
//Delete Feeds
if (count($feeds) > 0) {
foreach ($feeds as $feedId) {
deleteFeed($blogid, $feedId);
}
}
//Clear Plugin Database
// TODO : encapsulate with 'value'
$query = "SELECT name, value FROM {$database['prefix']}ServiceSettings WHERE name like 'Database\\_%'";
$plugintablesraw = POD::queryAll($query);
foreach ($plugintablesraw as $table) {
$dbname = $database['prefix'] . substr($table['name'], 9);
POD::execute("DELETE FROM {$database['prefix']}{$dbname} WHERE blogid = {$blogid}");
}
//Clear RSS Cache
if (file_exists(ROOT . "/cache/rss/{$blogid}.xml")) {
unlink(ROOT . "/cache/rss/{$blogid}.xml");
}
//Delete Attachments
Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
return true;
}
示例15: create
public function create()
{
if (!isset($this->structure) || empty($this->structure) || !is_array($this->structure)) {
return false;
}
/// TO DO : implementing create method by structure
$this->_called = true;
$sql = "CREATE TABLE " . $this->_getTableName() . " (" . CRLF;
$keys = array();
foreach ($this->structure as $field => $attributes) {
$type = $length = $isNull = $default = "";
foreach ($attributes as $attr => $value) {
if ($attr == "type") {
// Type casting
$type = POD::fieldType($value);
}
if ($attr == "isNull") {
$isNull = $value;
}
if ($attr == "default") {
$default = $value;
}
if ($attr == "length") {
$length = intval($value);
}
if ($attr == "autoincrement") {
$ai = $value;
}
if ($attr == "index" && $value == true) {
array_push($keys, $field);
}
}
$sql .= $field;
$sql .= ' ' . $type . (!empty($length) ? "(" . $length . ")" : "") . ' ' . ($default ? 'DEFAULT ' . (in_array($type, array("integer", "timestamp", "float")) ? $default : '"' . POD::escapeString($default) . '"') : "") . ' ' . ($isNull ? "NULL" : "NOT NULL") . (isset($ai) && $ai == true ? ' AUTO INCREMENT' : '') . ',';
}
$sql = rtrim($sql, ",");
if (is_array($this->option) && array_key_exists('primary', $this->option)) {
$sql .= ', PRIMARY KEY (' . implode(',', $this->option['primary']) . ')';
}
foreach ($keys as $key) {
$sql .= ', KEY (' . POD::escapeString($key) . ')';
}
$sql .= ")";
$result = POD::execute($sql);
$this->_manage_pool_stack();
return $result;
}