1 membership. */ function initialize() { session_start(); if (!function_exists('drush_get_context')) { require_once '../civicrm.config.php'; } // hack to make code think its an upgrade mode, and not do lot of initialization which breaks the code due to new 4.2 schema $_GET['q'] = 'civicrm/upgrade/cleanup42'; require_once 'CRM/Core/Config.php'; $config = CRM_Core_Config::singleton(); if (php_sapi_name() != "cli") { // this does not return on failure CRM_Utils_System::authenticateScript(TRUE); } } function run() { initialize(); $fh = fopen('php://output', 'w'); $rows = CRM_Upgrade_Incremental_php_FourTwo::deleteInvalidPairs(); if ( !empty($rows)) { echo "The following records have been processed. If action = Un-linked, that membership has been disconnected from the contribution record.\n"; echo "Contact ID, ContributionID, Contribution Status, MembershipID, Membership Type, Start Date, End Date, Membership Status, Action \n"; } else { echo "Could not find any records to process.\n"; } foreach ( $rows as $row ) { fputcsv($fh, $row); } } run();