当前位置: 首页>>代码示例>>PHP>>正文


PHP node_delete函数代码示例

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


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


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