• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP node_delete函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中node_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP node_delete函数的具体用法?PHP node_delete怎么用?PHP node_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了node_delete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: hook_user_cancel

/**
 * Act on user account cancellations.
 *
 * The user account is being canceled. Depending on the account cancellation
 * method, the module should either do nothing, unpublish content, anonymize
 * content, or delete content and data belonging to the canceled user account.
 *
 * Expensive operations should be added to the global batch with batch_set().
 *
 * @param $edit
 *   The array of form values submitted by the user.
 * @param $account
 *   The user object on which the operation is being performed.
 * @param $method
 *   The account cancellation method.
 *
 * @see user_cancel_methods()
 * @see hook_user_cancel_methods_alter()
 * @see user_cancel()
 */
function hook_user_cancel($edit, $account, $method)
{
    switch ($method) {
        case 'user_cancel_block_unpublish':
            // Unpublish nodes (current revisions).
            module_load_include('inc', 'node', 'node.admin');
            $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol();
            node_mass_update($nodes, array('status' => 0));
            break;
        case 'user_cancel_reassign':
            // Anonymize nodes (current revisions).
            module_load_include('inc', 'node', 'node.admin');
            $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol();
            node_mass_update($nodes, array('uid' => 0));
            // Anonymize old revisions.
            db_update('node_revision')->fields(array('uid' => 0))->condition('uid', $account->uid)->execute();
            // Clean history.
            db_delete('history')->condition('uid', $account->uid)->execute();
            break;
        case 'user_cancel_delete':
            // Delete nodes (current revisions).
            $nodes = db_select('node', 'n')->fields('n', array('nid'))->condition('uid', $account->uid)->execute()->fetchCol();
            foreach ($nodes as $nid) {
                node_delete($nid);
            }
            // Delete old revisions.
            db_delete('node_revision')->condition('uid', $account->uid)->execute();
            // Clean history.
            db_delete('history')->condition('uid', $account->uid)->execute();
            break;
    }
}
开发者ID:rentasite,项目名称:drupal,代码行数:52,代码来源:user.api.php


示例2: tearDown

 /**
  * {@inheritdoc}
  */
 public function tearDown()
 {
     parent::tearDown();
     foreach ($this->nodes as $node) {
         node_delete($node->nid);
     }
 }
开发者ID:janoka,项目名称:platform-dev,代码行数:10,代码来源:NextEuropaDataExportTest.php


示例3: groupDelete

 /**
  * @param int $groupID
  * @param $group
  */
 public static function groupDelete($groupID, $group)
 {
     $ogID = CRM_Bridge_OG_Utils::ogID($groupID, FALSE);
     if (!$ogID) {
         return;
     }
     node_delete($ogID);
 }
开发者ID:kidaa30,项目名称:yes,代码行数:12,代码来源:CiviCRM.php


示例4: tearDown

 function tearDown()
 {
     while (sizeof($this->_cleanupGroups) > 0) {
         $gid = array_pop($this->_cleanupGroups);
         node_delete($gid);
     }
     parent::tearDown();
 }
开发者ID:bhirsch,项目名称:voipdrupal-4.7-1.0,代码行数:8,代码来源:og_testcase.php


示例5: testCreateNode

 public function testCreateNode()
 {
     $this->loginAsAdmin();
     $node = $this->drupalCreateNode(array('uid' => 1, 'language' => 'en'));
     $this->assertNotNull($node);
     $this->assertTrue($node->nid > 0);
     node_delete($node->nid);
 }
开发者ID:enriquesanchezhernandez,项目名称:campaigns,代码行数:8,代码来源:FrameworkBootstrapTest.php


示例6: groupDelete

 static function groupDelete($groupID, $group)
 {
     require_once 'CRM/Bridge/OG/Utils.php';
     $ogID = CRM_Bridge_OG_Utils::ogID($groupID, false);
     if (!$ogID) {
         return;
     }
     node_delete($ogID);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:9,代码来源:CiviCRM.php


示例7: apply

    public function apply ( $patients ) {
        if ( !is_array($patients) ) {
            $patients = array($patients);
        }

        foreach ( $patients as $patient ) {
            \LogHelper::log_info('Applying DeleteReport treatment to: '.$patient->reportNodeId);
            node_delete($patient->reportNodeId);
        }
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:10,代码来源:DeleteReportTreatment.php


示例8: test_osha_workflow_get_set_project_manager

 public function test_osha_workflow_get_set_project_manager()
 {
     $this->assertNull(osha_workflow_get_project_manager(-1));
     $node = $this->createNodeNews();
     $pm3 = user_load_by_name('project_manager3');
     osha_workflow_set_project_manager($node->nid, $pm3->uid);
     $pm = osha_workflow_get_project_manager($node->nid);
     $this->assertEquals($pm3->uid, $pm->uid);
     $this->assertFalse(osha_workflow_is_assigned_project_manager($node->nid));
     $this->loginAs('project_manager3');
     $this->assertTrue(osha_workflow_is_assigned_project_manager($node->nid));
     node_delete($node->nid);
 }
开发者ID:enriquesanchezhernandez,项目名称:campaigns,代码行数:13,代码来源:WorkflowPublicationTest.php


示例9: tearDown

 function tearDown()
 {
     while (sizeof($this->_cleanupGroups) > 0) {
         $gid = array_pop($this->_cleanupGroups);
         node_delete($gid);
     }
     include_once './' . drupal_get_path('module', 'node') . '/content_types.inc';
     while (sizeof($this->_cleanupNodeTypes) > 0) {
         $name = array_pop($this->_cleanupNodeTypes);
         node_type_delete_confirm_submit(0, array('name' => $name, 'type' => $name));
     }
     parent::tearDown();
 }
开发者ID:sdboyer,项目名称:sdboyer-test,代码行数:13,代码来源:og_testcase.php


示例10: apply

    public function apply ( $patients ) {
        if ( !is_array($patients) ) {
            $patients = array($patients);
        }

        foreach ( $patients as $patient ) {
            \LogHelper::log_info('Applying DeleteDataset treatment to: '.$patient->datasetNodeId);
            // remove columns
            $columnNodeIds = gd_column_get_columns_4_dataset($patient->datasetNodeId, LOAD_ENTITY_ID_ONLY, INCLUDE_UNPUBLISHED);
            if ( !empty($columnNodeIds) ) {
                node_delete_multiple($columnNodeIds);
            }
            node_delete($patient->datasetNodeId);
        }
    }
开发者ID:reisystems-india,项目名称:GovDashboard-Community,代码行数:15,代码来源:DeleteDatasetTreatment.php


示例11: xxtestUserCanEditApprovers

 public function xxtestUserCanEditApprovers()
 {
     global $user;
     $user = user_load(1);
     $node = $this->drupalCreateNode(array('type' => 'news', 'language' => 'en', 'uid' => 1, 'title' => 'TEST NODE'));
     $user = user_load(0);
     $this->assertFalse(OshaWorkflowPermissions::userCanAccessApprovalScreen($node, NULL));
     $this->assertFalse(OshaWorkflowPermissions::userCanAccessApprovalScreen((object) array(), $user));
     $user = user_load(1);
     $this->assertTrue(OshaWorkflowPermissions::userCanAccessApprovalScreen($node, $user));
     $user = user_load_by_name('review_manager1');
     $this->assertTrue(OshaWorkflowPermissions::userCanAccessApprovalScreen($node, $user));
     $this->drupalLogout();
     node_delete($node->nid);
 }
开发者ID:enriquesanchezhernandez,项目名称:campaigns,代码行数:15,代码来源:OshaWorkflowPermissionsTest.php


示例12: deleteNode

 /**
  * Delete a node.
  */
 protected function deleteNode($nid)
 {
     // Implemention taken from node_delete, with some assumptions regarding
     // function_exists removed.
     node_delete($nid);
     //    $node = node_load($nid);
     //    db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
     //    db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
     //
     //    // Call the node-specific callback (if any):
     //    node_invoke($node, 'delete');
     //    node_invoke_nodeapi($node, 'delete');
     //
     //    // Clear the page and block caches.
     //    cache_clear_all();
 }
开发者ID:aimhighagency,项目名称:mjkim,代码行数:19,代码来源:location_testcase.php


示例13: bootstrap_theme_delete_collection

function bootstrap_theme_delete_collection($collection_id)
{
    $node = node_load($collection_id);
    if (!empty($node)) {
        node_delete($collection_id);
    }
    return '<div id="dashboard_a_collections">' . _bootstrap_theme_collections_html() . '</div>';
}
开发者ID:episolve,项目名称:clasnetworkdev,代码行数:8,代码来源:page.dashboard.php


示例14: delete

 /**
  * Delete the current entity from the database.
  */
 public function delete()
 {
     if ($this->getEntityType() == 'node') {
         node_delete($this->get('nid'));
     } else {
         entity_delete($this->getEntityType(), $this->get('id'));
     }
 }
开发者ID:alnutile,项目名称:entity_decorator,代码行数:11,代码来源:EntityDecorator.php


示例15: deleteFolder

 public function deleteFolder($filedepot_folder_id)
 {
     /* Test for valid folder and admin permission one more time
      * We are going to override the permission test in the function filedepot_getRecursiveCatIDs()
      * and return all subfolders in case hidden folders exist for this user.
      * If this user has admin permission for parent -- then they should be able to delete it
      * and any subfolders.
      */
     if ($filedepot_folder_id > 0 and $this->checkPermission($filedepot_folder_id, 'admin')) {
         // Need to delete all files in the folder
         /* Build an array of all linked categories under this category the user has admin access to */
         $list = array();
         array_push($list, $filedepot_folder_id);
         // Passing in permission check over-ride as noted above to filedepot_getRecursiveCatIDs()
         $list = $this->getRecursiveCatIDs($list, $filedepot_folder_id, 'admin', TRUE);
         foreach ($list as $cid) {
             // Drupal will remove the file attachments automatically when folder node is deleted even if file usage is > 1
             $query = db_query("SELECT drupal_fid FROM {filedepot_files} WHERE cid=:cid", array(':cid' => $cid));
             while ($A = $query->fetchAssoc()) {
                 $file = file_load($A['drupal_fid']);
                 file_usage_delete($file, 'filedepot');
                 if (file_exists($file->uri)) {
                     file_delete($file);
                 }
             }
             $subfolder_nid = db_query("SELECT nid FROM {filedepot_categories} WHERE cid=:cid", array(':cid' => $cid))->fetchField();
             db_delete('filedepot_categories')->condition('cid', $cid)->execute();
             db_delete('filedepot_categories')->condition('cid', $cid)->execute();
             db_delete('filedepot_access')->condition('catid', $cid)->execute();
             db_delete('filedepot_recentfolders')->condition('cid', $cid)->execute();
             db_delete('filedepot_notifications')->condition('cid', $cid)->execute();
             db_delete('filedepot_filesubmissions')->condition('cid', $cid)->execute();
             // Call the drupal node delete now for the subfolder node
             //watchdog('filedepot',"Calling node_delete for node id: {$subfolder_nid}");
             node_delete($subfolder_nid);
             // Remove the physical directory
             $uri = $this->root_storage_path . $cid;
             if (file_exists($uri)) {
                 $ret = @unlink("{$uri}/.htaccess");
                 $ret = @unlink("{$uri}/submissions/.htaccess");
                 $ret = @drupal_rmdir("{$uri}/submissions");
                 $ret = @drupal_rmdir($uri);
             }
         }
         return TRUE;
     } else {
         return FALSE;
     }
 }
开发者ID:dalia-m-elsayed,项目名称:spica,代码行数:49,代码来源:filedepot.class.php


示例16: db_query

<?php

$result = db_query("SELECT entity_id FROM `field_data_field_obec` WHERE `field_obec_value` LIKE 'Slovakia,%%' AND entity_type='node'");
foreach ($result as $record) {
    echo $record->entity_id . "\n";
    node_delete($record->entity_id);
}
开发者ID:brainsum,项目名称:memosaic,代码行数:7,代码来源:remove_invalid.php


示例17: valghallaTestdataIsAvailable

 /**
  * @Given Valghalla testdata is available
  */
 public function valghallaTestdataIsAvailable()
 {
     // @Todo
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', 'node')->propertyCondition('title', 'Test Deltager No-Mail');
     $result = $query->execute();
     if (isset($result['node'])) {
         node_delete(key($result['node']));
     }
     $node = (object) array('vid' => NULL, 'uid' => '1', 'title' => 'Test Deltager No-Mail', 'log' => '', 'status' => '1', 'comment' => '0', 'promote' => '1', 'sticky' => '0', 'nid' => NULL, 'type' => 'volunteers', 'language' => 'da', 'created' => '1428566112', 'changed' => '1428568628', 'tnid' => '0', 'translate' => '0', 'revision_timestamp' => '1428568628', 'revision_uid' => '1', 'field_address_bnummer' => array(), 'field_address_city' => array(), 'field_address_coname' => array(), 'field_address_door' => array(), 'field_address_floor' => array(), 'field_address_road' => array(), 'field_address_road_no' => array(), 'field_address_zipcode' => array(), 'field_cpr_number' => array('da' => array(array('value' => '123456-1213', 'format' => NULL, 'safe_value' => '123456-1213'))), 'field_cpr_valid_date' => array(), 'field_diaet' => array('da' => array(array('value' => '750'))), 'field_email' => array('da' => array(array('email' => '[email protected]'))), 'field_label' => array(), 'field_party' => array('da' => array(array('tid' => '3'))), 'field_phone' => array('da' => array(array('value' => '0', 'format' => NULL, 'safe_value' => '0'))), 'field_phone2' => array(), 'field_polling_station' => array(), 'field_polling_station_post' => array(), 'field_rolle_id' => array(), 'field_meeting_time' => array(), 'field_ending_time' => array(), 'field_cpr_status' => array(), 'field_external_signup' => array('und' => array(array('value' => '0'))), 'field_valid_state' => array('und' => array(array('value' => 'invalid'))), 'field_volunteer_valid_date' => array('und' => array(array('value' => '2015-04-09 08:00:00', 'timezone' => 'Europe/Copenhagen', 'timezone_db' => 'UTC', 'date_type' => 'datetime'))), 'field_no_mail' => array('und' => array(array('value' => 1))), 'name' => 'admin', 'picture' => '0', 'data' => 'a:7:{s:7:"contact";i:1;s:16:"ckeditor_default";s:1:"t";s:20:"ckeditor_show_toggle";s:1:"t";s:14:"ckeditor_width";s:4:"100%";s:13:"ckeditor_lang";s:2:"en";s:18:"ckeditor_auto_lang";s:1:"t";s:17:"mimemail_textonly";i:0;}');
     node_save($node);
     $volunteer_no_mail_nid = $node->nid;
     return TRUE;
 }
开发者ID:OS2Valghalla,项目名称:valghalla,代码行数:17,代码来源:FeatureContext.php


示例18: delete

 /**
  * Deletes a text
  *
  * @param int $nid ["path","0"]
  *  The nid of the text to delete
  * @return bool
  *
  * @Access(callback='DocuWalkTextResource::access', args={'delete'}, appendArgs=true)
  */
 public static function delete($nid)
 {
     node_delete($nid);
 }
开发者ID:hugowetterberg,项目名称:docuwalk,代码行数:13,代码来源:DocuWalkTextResource.php


示例19: cleanup_DeleteDuplicateExportArticles

function cleanup_DeleteDuplicateExportArticles($printDebugReport = false, $param = 50)
{
    $ret = array();
    $query = "\n        SELECT n1.title as 'Title',\n        count(n1.title) as 'Count',\n        GROUP_CONCAT(n1.nid) as 'nodeIds'\n        FROM  node n1\n        WHERE n1.type='export_gov_micro_site_page' AND n1.status=1\n        GROUP BY n1.title\n        HAVING count(n1.title) > 1 LIMIT " . $param . ";";
    $results = db_query($query);
    foreach ($results as $result) {
        $duplicateNids = explode(',', $result->nodeIds);
        foreach ($duplicateNids as $index => $dupNodeId) {
            if ($index === 0) {
                // This is the first Node of its kind, do not delete this one
                $firstEventOfItsKind = $dupNodeId;
            } else {
                // This is not the first Node of its kind, delete this one
                $ret[] = $dupNodeId;
                node_delete($dupNodeId);
                $msg = __FILE__ . '::' . __FUNCTION__ . " - Deleted Export Articles node {$dupNodeId} because it is a duplicate of node {$firstEventOfItsKind}. Title={$result->Title}";
                error_log($msg);
                if ($printDebugReport) {
                    drupal_set_message($msg, 'warning');
                }
            }
        }
    }
    return $ret;
}
开发者ID:hosttor,项目名称:BusinessUSA-OpenSource,代码行数:25,代码来源:CleanUp.php


示例20: save

 public function save($nid_parkauto, $sop_selected, $user_nid)
 {
     // elimina tutti i CT sop presenti con il nid.
     if ($nid_parkauto) {
         $query = new EntityFieldQuery();
         $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'servizi_opzionali_planning')->propertyCondition('status', 1)->fieldCondition('field_sop_nid_parkauto', 'value', $nid_parkauto)->addMetaData('account', user_load(1));
         $qryres = $query->execute();
         if (isset($qryres['node'])) {
             $items_nids = array_keys($qryres['node']);
             foreach ($items_nids as $knode => $vnode) {
                 node_delete($vnode);
             }
         }
     }
     if (gettype($sop_selected) != 'object') {
         $xdebug = 1;
     }
     $ar = get_object_vars($sop_selected);
     if (empty($ar)) {
         return;
     }
     // Ricrea i nuovi nodi
     foreach ($sop_selected as $k => $elem) {
         if ($elem->{'nid_parkauto'}) {
             $this->build_new_node('servizi_opzionali_planning', $elem, $user_nid);
         }
     }
 }
开发者ID:remo-candeli,项目名称:remoc-test,代码行数:28,代码来源:servizi_opzionali.php



注:本文中的node_delete函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP node_get_type_label函数代码示例发布时间:2022-05-15
下一篇:
PHP node_build_content函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap