Sarrafa maganganun WordPress tare da umarnin MySQL

Ago wani lokaci da suka wuce na nuna muku yadda ake sarrafa shafukan WordPress tare da umarni, ta hanyar rubutun ne perl. A wannan yanayin, zan nuna muku takamaiman yadda ake sarrafa maganganun WordPress ta amfani da tambayoyin SQL, ma'ana, ta yin amfani da umarni a cikin na'urar MySQL.

Abu na farko da ya kamata a tuna shine dole ne su sami damar zuwa tashar MySQL ko kayan wasan bidiyo, a ce mun sami dama ga sabar ta SSH kuma a ciki muke rubutawa:

mysql -u tushen -p
Wannan yana ɗauka cewa mai amfani da MySQL ɗinmu yana da tushe, idan kuma wani ne, kawai canza asalin mai amfanin ku

Da zarar an rubuta wannan kuma an danna shi Shigar zai nemi kalmar sirri na wancan mai amfani da MySQL din, sun rubuta shi, sun sake latsawa Shigar kuma voila, da sun riga sun isa:

Mysql-tashar-samun dama

Da zarar cikin cikin harsashin MySQL dole ne mu nuna wane rumbun adana bayanan da zamu yi amfani da su, zaku ga wadatar bayanan bayanan tare da:

nuna bayanai;
A cikin MySQL shine da muhimmanci sosai koyaushe ƙare umarnin tare da semicolon;

Wannan zai nuna maka kamar yadda na fada akwai rumbunan adana bayanai, a ce an kira wanda ake so shafin yanar gizo, bari mu fara amfani da shi:

amfani da shafin yanar gizo;

Bari mu sake nazarin abin da ake kira teburin tare da:

nuna tebur;

Wannan zai gaya mana sunayen teburin, mai matukar mahimmanci saboda dole ne mu ga menene ainihin sunan teburin da ya shafi maganganun shine: sharhi

Yawanci ana kiranta wp_comments ko makamancin haka, mahimmin abu shine koyaushe yana ƙare a: sharhi

Share maganganun SPAM

Tare da wannan layin za'a share duk bayanan da aka yiwa alama a matsayin SPAM:

KASHE daga wp_comments INA comment_approved = 'spam';
Ka tuna, idan ya gaya maka cewa teburin wp_comments babu shi to dole ne ka canza wp_comments zuwa ainihin sunan teburin sharhi, sunan da ke sama bayan teburin nunawa; ya bayyana a gare su

Share duk maganganun da ke jiran daidaitawa

KASHE DAGA wp_comments INA comment_haka = '0';

Sauya rubutu a cikin duk sharhi

A ce muna son bincika duk maganganun don kalmar "siyasa" kuma maye gurbin ta da "lalatacce", zai zama:

GABATAR da wp_comments SET `comment_content` = Sauya (` `comment_content ',' politicos ',' 'masu lalata');

Share tsokaci dangane da shafin yanar gizon marubucin

Bari muyi tunanin cewa saboda wani dalili muna son kawar da duk maganganun kowane mai amfani wanda, lokacin yin tsokaci, ya bayyana a cikin bayanin sigar tsokaci (suna, shafin da imel) cewa rukunin yanar gizon su ne http://taringa.com (don buga misali) , Zai zama kamar haka:

KASHE daga wp_comments INA comment_author_url LIKE 'http://taringa.com';

Rufe tsokaci kan tsofaffin labarai

Na san mutanen da suke son rufe tsoffin tsoffin rubuce-rubuce a shafukan su, don haka dole ne su shirya sakonnin daya bayan daya don kashe zabin "an kunna bayani" a cikin kowanne, wannan layin zai warware musu rayuwa:

UPDATE wp_posts SET comment_status = 'an rufe' INA post_date <'2010-02-10' DA post_status = 'buga';

Kamar yadda kake gani, a tsakiyar layin akwai wata kwanan wata, 2010-02-10, wannan yana nufin cewa duk sakonnin da aka buga kuma suna da kwanan watan bugawa ƙasa da 10 ga Fabrairu, 2010 (ma'ana, an riga an buga su a baya) ) zai rufe bayanan, babu wanda zai sake yin sharhi a kansu.

Rufe tsokaci akan duk abubuwan

Idan ba kwa son rufe maganganun kawai a cikin wasu sakonni amma gabaɗaya, wannan layin zai taimaka muku:

UPDATE wp_posts SET comment_status = 'an rufe', ping_status = 'an rufe' INDA comment_status = 'bude';

Idan kuna son juyawa wannan, canzawa rufe don buɗewa kuma akasin haka, kuma voila, sake aiwatar da layin tare da canje-canje.

Share bayanan da aka yi a cikin wani kewayon lokaci

A ce muna son share duk maganganun da aka yi a ranar 1 ga Afrilu, 2014, tsakanin 4:15 na rana da 10:40 na dare, layin zai zama:

KASHE DAGA wp_comments INA comment_date> '2014-04-01 16:15:00' DA comment_ kwanan wata <= '2014-04-01 22:40:00';

Kamar yadda kake gani, lokaci yana cikin tsari na awanni 24, ma'ana, lokacin soja.

Karshe!

Da kyau, babu wani abu da za a ƙara, na san cewa fiye da ɗaya za su sami wannan ban sha'awa.

gaisuwa


Abubuwan da ke cikin labarin suna bin ka'idodinmu na ka'idojin edita. Don yin rahoton kuskure danna a nan.

7 comments, bar naka

Bar tsokaci

Your email address ba za a buga. Bukata filayen suna alama da *

*

*

  1. Mai alhakin bayanan: Miguel Ángel Gatón
  2. Dalilin bayanan: Gudanar da SPAM, gudanar da sharhi.
  3. Halacci: Yarda da yarda
  4. Sadarwar bayanan: Ba za a sanar da wasu bayanan ga wasu kamfanoni ba sai ta hanyar wajibcin doka.
  5. Ajiye bayanai: Bayanin yanar gizo wanda Occentus Networks (EU) suka dauki nauyi
  6. Hakkoki: A kowane lokaci zaka iyakance, dawo da share bayanan ka.

  1.   @Bbchausa m

    Ina tsammanin kawai kunyi hacking daga Fromlinux ba tare da kun sani ba hahaha

  2.   diazepam m

    Menene ya faru da pint ɗin wannan labarin? Wannan yana kama da shit.

    1.    bari muyi amfani da Linux m

      shirye gyarawa
      wannan Alejandro ...

  3.   bari muyi amfani da Linux m

    haha! daina yin shit alejandro!
    lokacin da na kama ku….

  4.   Yeretic m

    Kuma ba koyawa na MySQL zai sa hankali ba? Ko kuma, idan abin da kuke so shi ne "Sarrafa maganganun kalmomin shiga daga na'ura mai kwakwalwa" aƙalla ku sami kayan ado don gabatar da rubutun harsashi wanda ke sarrafa duk waɗannan tambayoyin.

    Koyaya, iyakance gudummawata ga post (menene sabon abu!)

    Don ɗora bayanan WordPress kuma sanya ƙasa:
    SHA BAYANAI;

    Ina fatan yana da amfani ... 😉

    1.    KZKG ^ Gaara m

      Zai fi zama koyawa na MySQL, querys da sauransu ... amma, ga waɗanda kawai suke son yin wasu canje-canje a cikin maganganun WordPress, zai zama ba shi da amfani, ba za su fahimci da yawa ba.

      Game da batun samun ko babu kayan ado, zo kan Willians, da farko kun ba da gudummawa wani abu sannan, sannan ku soki gudummawar wasu ok 😉

      Ina shafinka / blog dinka mai amfani ga al'umma? Na tambaya me ya sa, dole ne ku sami ƙawa da mutunci, dama? ^ _ ^

      1.    Raphael Castro ne adam wata m

        Mafi kyawun sashin gidan…. gurbatattun ‘yan siyasa

        +1