hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Hosting Security and Technology Tutorials : HOW-TO: Remove Urchin profiles from cpanel box
Reply

Hosting Security and Technology Tutorials Tutorials related to server security or the like.
Forum Jump

HOW-TO: Remove Urchin profiles from cpanel box

Reply Post New Thread In Hosting Security and Technology Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 07-22-2004, 11:40 PM
thaphantom thaphantom is offline
WHT Addict
 
Join Date: May 2003
Posts: 147

HOW-TO: Remove Urchin profiles from cpanel box


Have Urchin? Have cPanel?
We when deleting an account in cpanel the urchin profile remains. Here is how to get rid of those profiles.

PHP Code:
#!/usr/local/cpanel/3rdparty/bin/php 

<?php 

// path to urchin folder ~ no trailing slash 
$urchin_path "/usr/local/urchin"

// Your access hash key from WHM panel 
$accesshash 'INSERT YOUR ACCESS KEY HASH HERE'




/* Syntax we are using... You can find info on urchin and cpanel sites 

List all urchin profiles - /usr/local/urchin/util/uconf-driver action=list table="profile" 
Remove urchine profile $name - /usr/local/urchin/util/uconf-driver action=delete table="profile" name="$name" 
List all cpanel accounts of $user - $accts = listaccts($host,$user,$accesshash,0); 

*/ 

// cPanel variables 
require '/usr/local/cpanel/Cpanel/Accounting.php.inc'
$host "localhost"
$user "root"



$accts listaccts($host,$user,$accesshash,0); 

// Cycle through array that is returned. The first of each account array contains domain 
foreach($accts as $current_account
    
$ALL_ACCOUNT_DOMAINS[] = $current_account[0]; 


// Get number of records in urchin db 
$urchin_num = `{$urchin_path}/util/uconf-driver action=nrecords table="profile"`; 

$urchin_command "{$urchin_path}/util/uconf-driver action=list table=\"profile\" start=0 n=" trim($urchin_num); 

// Contains all return info 
$urchin_id_strings = `$urchin_command`; 

// Create array based on spaces 
foreach(explode(" "$urchin_id_strings) as $current_value

    
// Look for format of profile names, store in regs 
    
if (ereg("^(name=)\"([^\"]+)\""$current_value$regs)) 
    { 
        
// If current profile is not in cpanel accounts, assume it needs to be removed 
        
if (array_search($regs[2], $ALL_ACCOUNT_DOMAINS) === false
        { 
            
$IDS_TO_REMOVE[] = $regs[2]; 
        } 
    } 


if (!empty(
$IDS_TO_REMOVE)) 

    
// Yes, I know -- we could have done this command earlier. But lets just place it here 
    
foreach($IDS_TO_REMOVE as $current_profile
    { 
        
// Remove current_profile 
        
$result = `{$urchin_path}/util/uconf-driver action=delete table="profile" name="$current_profile"`; 
    } 


// Check new urchin number 
$new_urchin_num = `{$urchin_path}/util/uconf-driver action=nrecords table="profile"`; 

// Echo out how many records have been removed. 
echo "Profiles Removed: " . (trim($urchin_num) - trim($new_urchin_num)) . "\n\n";
Put that in a file called remurchin.php and then run it
Code:
php remurchin.php
[Code originally posted at the cPanel Forums by Patiek]

Taken from MyCPAdmin.com

Reply With Quote


Sponsored Links
Reply

Related posts from TheWhir.com
Title Type Date Posted
cPanel Conference 2012: Branding and How to Do it Better with Felipe Gasper Web Hosting News 2012-10-09 18:00:02
Video: cPanel and Attracta Talk About Integrating SEO Tools into the Hosting Control Panel Whir Tv 2012-08-31 14:10:47
Google Retires Web Analytics Software Tool Urchin Web Hosting News 2012-01-23 17:41:34
cPanel Kicks Off Automation Bootcamp Conference on Monday Web Hosting News 2011-10-07 14:49:20
cPanel to Launch Certification Program at cPanel Conference 2011 Web Hosting News 2011-09-21 18:15:42


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?