/opt/dedrads/cms_tools/__pycache__
NameSizeModeActions
cms.cpython-313.pyc226940644editdlrm
common.cpython-313.pyc51370644editdlrm
db.cpython-313.pyc210570644editdlrm
helpers.cpython-313.pyc239580644editdlrm
__init__.cpython-313.pyc1310644editdlrm
Edit: /opt/dedrads/cms_tools/__pycache__/db.cpython-313.pyc (21057B)
}jGSrSSKrSSKrSSKrSSKrSSKrSSKJr SSKJ r J r J r J r J r JrJrJrJrJrJr SSKJrJr \R."\5rSrSrSS jrS rS rS rS r Sr!Sr"Sr#Sr$g)z(Database functions for working with CMS.N) prompt_y_n) common_get_stringmake_valid_db_name import_dbdump_db db_existsdb_user_exists create_dbcreate_db_userchange_db_passassociate_db_user get_mysql_err) CMSStatusCMSErrorc[RSXR5 URnX R;a[ UR UR URURS5nU(dEUR[RSUR-5 [SUR-5e[RSU5 X0RU'[UR UR URU5$)zK Import database, using known credentials. Also, make backup if necessary. zAttempting to import %s into %scms_tools_backupzUnable to backup %szModifying database %s)LOGGERdebugdb_name modified_dbsrdb_userdb_passdirectory_root set_statusrcriticalrinfor)the_cms database_filedatabase dump_files /opt/dedrads/cms_tools/db.py import_cms_dbr#!s  LL)=//H+++ OO OO OO  " "      ""$9GOO$K 07??BC C +X6)2X& '//= c[RS5 [R"URUR UR URS9nUR5nURS5S:XaSSS5 SSS5 gSSS5 SSS5 g!,(df  N=f!,(df  g=f![Ra!n[RS5 UsSnA$SnAff=f)z0 Test the database connection and return errors zTesting db connectionhostuserpasswordr SHOW TABLESrNzConnection error) rrpymysqlconnectdb_hostrrrcursorexecuteError)rconnr.errs r"test_db_connectionr3Cs LL()  ______  &>>-0A5   6         == '( s_?CB2'B!>B2CB2C! B/ +B22 C<CCC8C3-C83C8cUR[R:a![R SUR 5 gUS:XaUS:wa[R S5 SnURRSS5nSUURSS5S3nSURSS5S3nUS:Xa SUSUS 3nSn O%SURSS5S3n U4n SUSUS U S 3n[R"URURURUR S 9n U R5n U RX5n U S :aSSS5 SSS5 gU R!5SsSSS5 sSSS5 $!,(df  O=fSSS5 g!,(df  g=f![R"an[R U5 SnAgSnAff=f)zJ Search database returning specific field with optional search parameters zBDatabase %s has not yet been confrmed working, but query attemptedNz(Search field given, but no pattern given`z``zSELECT z FROM ;z WHERE z LIKE %sr&rr)statusrdb_has_matching_tablesrerrorrwarningdb_prefreplacer+r,r-rrr.r/fetchallr0)rfieldtable search_fieldsearch_patternprefix escaped_table escaped_fieldqueryargsescaped_searchr1r.resultr2s r" simple_queryrJXs ~~ 888  " OO  2  NNE FL __ $ $S$ /Fx c4 89;M c4013M-}oQ?\11#t<=Q? m_F=/:#$H .  ______  &4A:   (+         == Ssf%?F0$F5FFF0F1 F: F0 F FF0 F-)F0-F00G#GG#c [R"SURS[UR5- 4-UR5(Gd[ R SUR5 [URURURSS9nSULa[SSURS[UR5- 4-5nSULaOURSU5(dg URS5Ul[ R S UR5 O[ RS UR5 g URS :d[S U-5(aOURSU5(dg URS5Ul[ R S UR5 OZ[SS5nURSU5(dg URS5Ul[ R S UR5 [URUR5(dURS :d[SUR-5(a[!URURUR"5 [URUR5(d.UR%[&RSUR-5 g O.UR%[&RSUR-5 g [)U5nUc[ R+S5 gSUS:XaURS :d[SUR-5(aQ[-URURUR"5(d [ RSUR5 g[ RSUR5 g SUS:XagUup4[ R SUU5 g)z9 Check whether the database user and password is correct %s_[a-z0-9]{1,%d}z%Database username '%s' is not correctr( name_typeNzWhat new name would you like? rFzUsername set to %szUsername '%s' not reset!rzSet name to %s? zUse what database user name: r z-Database user '%s' does not exist. Create it?z#Failed to create database user '%s'zCould not create %szAuthorization fixedTrz/Password for user '%s' doesn't match. Reset it?zCould reset password for %s.zCould not fix password for %s.zLDatabase connection failing. Can't check username. Receiving error: (%d): %s)rematchdbprefixlenrrrrcpuserr set_variable get_variabler:ilevelrr r rrrr3rr rnew_namerIerrnosterrors r" check_db_authr^sK 88w//c':J:J6K1KLL    ;W__M% NNG,,goo  8 )0###R#g.>.>*?%?@AH 8#++Ix@@ ")"6"6y"A 0'//B 7I ~~!Z0BX0M%N%N++Ix@@ ")"6"6y"A 0'//B,3Z++Ix@@ ")"6"6y"A 0'//B '..'// : : >>A  ;goo M" "  7>>7??GOO L"'..'//BB""OO9GOOK C   !6!H   (F ~ *+ vay >>A  = O" " " ;W__M 5wG vayU KK %   r$c [R"SURS[UR5- 4-UR5(Gd[ R SUR5 [URURUR5nSULa[SSURS[UR5- 4-5nSULaOURSU5(dgURS5Ul[ R SUR5 OUR[RS 5 gURS :d[!S U-5(aOURSU5(dgURS5Ul[ R SUR5 OZ[S S 5nURSU5(dgURS5Ul[ R SUR5 [#URUR5(dURS :d[!SUR-5(at[%URUR5 [#URUR5(d.UR[RSUR-5 gO!UR[RS5 g['U5nUc[ R)S5 g[+U5up4US;a#[ RSURUU5 g[ R)S5 URS :d-[!SUR,<SUR<S35(a,[/URURUR,5 gUR[RS5 [ R1S5 g)z? Check whether the database exists and the user has privileges rLrMz!Database name '%s' is not correctNz'What new database name would you like? rFzDatabase name set to %szDatabase name not correctrzSet name to %s?zUse what database name: r z(Database '%s' does not exist. Create it?zFailed to create database '%s'zDatabase could not be createdzDatabase connection fixed.TrQiz2Still could not connect to '%s'. New error: %d: %sz=The database exists, but the user cannot access the database.zAssociate database user 'z' with database 'z'?z"Could not associate database user.)rRrSrTrUrrrrrVrrWrXrrr:rYrr r r3rrrrr;rZs r"check_db_accessras: 88w//c':J:J6K1KLL    7I% NNG,,goo  8 )9###R#g.>.>*?%?@AH 8#++Ix@@ ")"6"6y"A 5wG""9??4OP ~~!Z0AH0L%M%M++Ix@@ ")"6"6y"A 5wG,. ++Ix@@ ")"6"6y"A 5wG W^^W__ 5 5 >>A  6 H" "  gnngoo 6W^^W__==""OO4wF >   y0O P  (F ~ 12"6*NE L  @ OO     LLG ~~Z ??GOO - '..'//7??K   OOA  ;<r$c UR[R:a![R SUR 5 gSUR :wa[RSUR 5 URS:d[S5(aCURSS5(dgURS5Ul[RS5 [U5nUc[RS 5 g [U5S $) z` Check for database connection errors. Return None if no error or number if there was an errror 6Database credentials haven't been set. Last status: %s localhostDatabse host is set to '%s'.rSet database host to localhost?r-Database host has been fixedNzDatabase connection workingr)r8r db_is_setrr;reasonr-rrYrrWrXrr3r)rrIs r"check_db_errorrk]s~~ +++ D NN goo% 2GOOD >>A ,M!N!N'' ;??%229=GO LL7 8  (F ~ 23   ##r$c~UcgUS:Xag[RSUR5 US:Xa [RS5 [U5$US;a [RS5 [ U5$US :Xa[RS 5 g[R S 5 [R U5 g) 2 Check whether the database connection is working TrdFz!There was a database error for %srPz%The username or password is incorrectr`z#The user cannot access the databaseiz>MySQL server has gone away. May need to be researched manuallyzUnknown error.)rrrr^rar:)r error_numbers r" fix_db_errorro~s r KK3W__Et ;<W%%|# 9:w''t L  LL!" LL r$cUR[R:a![R SUR 5 gSUR :wa[RSUR 5 URS:d[S5(aCURSS5(dgURS5Ul[RS5 [U5nS nS ULaZ[X5(d[RS U5 gUS- nUS :a[RS 5 g[U5nS ULaMZUR![R"S5 g)rmrcFrerfrrgr-rhrNz#Could not resolve database error %s z$Too many database errors. Giving up.zDatabase confirmed connectedT)r8rrirr;rjr-rrYrrWrXrrkror:rdb_is_connecting)rdb_errorcounts r"check_dbrus' ~~ +++ D NN goo% 2GOOD >>A ,M!N!N'' ;??%229=GO LL7 8g&H E h G.. KK=x H   2: LL? @!'* h  ""$B r$c.UR[R:a&[U5(d[R S5 g[ R"URURURURS9nUR5nURS5S:Xa=[RSUR5 [U5sSSS5 sSSS5 $UR![R"S5 URS UR$45nUS:XaH[RS URUR$5 [U5sSSS5 sSSS5 $SSS5 SSS5 UR![R*S R-URUR$55 g !,(df  N[=f!,(df  Nd=f![ R&an[)S U35UeSnAff=f)zt Check database to ensure that is not empty, and that it has tables matching the prefix. If not, attempt to import. zGDatabase has not been confirmed to connect. Cannot check database data.Fr&r*rzNo tables in '%s'NzDatabase has tableszSHOW TABLES LIKE %s%%z>-0A5KK 3W__E'0   ""++-B+goo-?A:KK=  (0#     4 ((<CC OOW__  5   0 ==@/u56C?@sn?G,GAG  G G,)A8G ! G* G,5G=G, G G G)%G,)G,,HHHc[URURUR5n[URURUR SS9nUR SU5 UR SU5 g)zQ Set database name and database user names to proper names which fit with cPanel r(rNrrN)rrVrTrdbuserrrW)r new_db_name new_db_users r" fix_db_namesrsh%(('//K%(('//VK K0 K0r$c jUR[R:a&[U5(d[R S5 g/nUR UR4HnURHn[R"[RRUSU-55H]nXA;aM URU5 URS:d#[SUSURS35(dMN[!X5s s s $ M M URS:df[#SUR-S S 9nUbL[RR%U5(a [!X5$[#S URS 3S S 9nUbMLUR'[R S UR35 g)z% Attempt to find and import database z5Database not confirmed connecting. Cannot import dataFz*%s*.sqlrzImport z in to ?z-Please specify a database to import into %s: N)defaultz=File does no exist. Please specify a database to import into z: z%Could not find a database export for )r8rrrrurr; orig_db_namerdb_file_search_pathglobospathjoinappendrYrr#risfiler)r found_filesdbname the_directorydb_files r"rwrws ~~ 222  NNG K''9$88M99 ]J,?@)""7+>>A%gYggoo->a@**)::9: >>A # "$+OO 4  !ww~~g&&$W66'++2??*;2?G!  //@A r$)r5r5)%__doc__rrRloggingrr+radsrhelpersrrrrr r r r r rrcmsrr getLogger__name__rr#r3rJr^rarkrorurzrrwr$r"rs.      %   8 $D*-`eVdT$BB'Z/d1*/r$