[freeside-commits] branch master updated. 5b5168d7ada7b6ca5375762837dc999cab0e8a9e

Ivan ivan at 420.am
Mon Sep 9 00:37:17 PDT 2013


The branch, master has been updated
       via  5b5168d7ada7b6ca5375762837dc999cab0e8a9e (commit)
      from  992f784a5f012c7a954f86c62d0977ec947a3170 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5b5168d7ada7b6ca5375762837dc999cab0e8a9e
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Mon Sep 9 00:37:14 2013 -0700

    quick tools for profiling phone number insert/delete, RT#24767

diff --git a/bin/svc_phone-bulk_delete b/bin/svc_phone-bulk_delete
new file mode 100755
index 0000000..28f1a3f
--- /dev/null
+++ b/bin/svc_phone-bulk_delete
@@ -0,0 +1,36 @@
+#!/usr/bin/perl -w
+
+use strict;
+use DBIx::Profile;
+use FS::UID qw( adminsuidsetup );
+use FS::Record qw( qsearch );
+use FS::svc_phone;
+
+my $user = shift or die &usage;
+my $dbh = adminsuidsetup($user);
+
+#my $pkgnum = shift or die &usage;
+#my $svcpart = shift or die &usage;
+
+my @svc_phone = qsearch( {
+  'table'   => 'svc_phone',
+  'hashref' => { 'phonenum' => { op=>'LIKE', value=>'3125%', } },
+});
+
+my $num = 0;
+
+foreach my $svc_phone ( @svc_phone ) {
+  my $error = $svc_phone->delete;
+  die $error if $error;
+  #last if $num++ > 54;
+}
+
+
+print "\n";
+print $dbh->sprintProfile;
+
+sub usage {
+  die "Usage:\n svc_phone-bulk_delete user\n";
+}
+
+1;
diff --git a/bin/svc_phone-bulk_insert-profile b/bin/svc_phone-bulk_insert-profile
new file mode 100755
index 0000000..b1ed899
--- /dev/null
+++ b/bin/svc_phone-bulk_insert-profile
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -w
+
+use strict;
+use DBIx::Profile;
+use FS::UID qw( adminsuidsetup );
+#use FS::Record qw( qsearchs );
+use FS::svc_phone;
+
+my $user = shift or die &usage;
+my $dbh = adminsuidsetup($user);
+
+my $pkgnum = shift or die &usage;
+my $svcpart = shift or die &usage;
+
+#$FS::cust_pkg::DEBUG = 3;
+$FS::cust_svc::ignore_quantity = 1;
+
+#for ( 1..50000 ) {
+for ( 1..5000 ) {
+  my $svc_phone = new FS::svc_phone {
+    'countrycode' => 1,
+    'phonenum'    => '3125550000' + $_,
+    'pkgnum'      => $pkgnum,
+    'svcpart'     => $svcpart,
+  };
+  my $error = $svc_phone->insert;
+  die $error if $error;
+  print '.' unless $_ % 50 # % 1000;
+}
+
+print "\n";
+print $dbh->sprintProfile;
+#$dbh->printProfile;
+
+sub usage {
+  die "Usage:\n svc_phone-bulk_insert-profile user pkgnum svcpart\n";
+}
+
+1;

-----------------------------------------------------------------------

Summary of changes:
 bin/svc_phone-bulk_delete         |   36 ++++++++++++++++++++++++++++++++++
 bin/svc_phone-bulk_insert-profile |   39 +++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 0 deletions(-)
 create mode 100755 bin/svc_phone-bulk_delete
 create mode 100755 bin/svc_phone-bulk_insert-profile




More information about the freeside-commits mailing list