Do you run a blog with multiple authors? Then, you probably have wondered how you can set a minimum word count for your posts in WordPress. In this article, we will share with you a snippet that lets you set a minimum Word count for your WordPress posts. If a user tries to publish a post that is too small, then it will return an error telling them the post is not long enough.
Simply open your theme’s functions.php file and paste the following code:
function minWord($content)
{
global $post;
$content = $post->post_content;
if (str_word_count($content) < 100 ) //set this to the minimum number of words
wp_die( __('Error: your post is below the minimum word count. It needs to be longer than 100 words.') );
}
add_action('publish_post', 'minWord');
You may change the minimum number of words from 100 to whatever you like. You can also customize the error to make it helpful.
Depuis sa création, il est devenu le moteur par défaut de MySQL. Il a remplacé Isam en y ajoutant des extensions. En raison de sa souplesse, simplicité et rapidité, MyISAM gagne en popularité dans les applications du web.
Il est très utilisé pour le web car, comme il ne gère ni les clés étrangères, ni les transactions, il n’a pas à vérifier la validité des enregistrements. Cela permet donc un précieux gain de temps sur des tables très fréquemment ouvertes en écriture/lecture.
En effet, lorsque vous faites des suppressions sur des champs de type VARCHAR, CHAR, BLOB ou TEXT, le moteur supprime le contenu mais la place précédemment supprimée est conservée et peut être réutilisée ultérieurement. OPTMIZE va défragmenter la table afin de gagner de la place et ainsi faciliter l’accès aux données sur cette table.
Sélectionnez
OPTIMIZE maTable;
Rien ne sert d’exécuter cette commande sur toutes les tables en permanence. Vous risquez de faire baisser les performances si beaucoup de connexions s’effectuent en même temps. Cette commande doit être utilisée seulement sur des tables dont la taille évolue rapidement.
D’après ses détracteurs, MySQL ne serait pas capable de gérer les transactions. En réalité, les personnes ayant utilisé MySQL ne savaient pas qu’il était possible de changer de moteur. Ils sont tombés sur le moteur par défaut, MyISAM, qui ne gère pas les transactions.
Une table MyISAM utilise trois fichiers :
maTable.FRM : Fichier de définition de la table
maTable.MYD : Fichier contenant les données de la table
Licence : GPL niveau 2. Société InnoBase, filiale depuis 2005 de la société Oracle.
Version de MySQL : Par défaut depuis la version 4.0 de MySQL mais il y est possible de l’installer sur une version 3.23 de MySQL.
Type : Transactionnel
Domaines d’application : Application nécessitant une fiabilité de l’information avec une gestion des transactions
X-A. Description
InnoDB, est le moteur transactionnel le plus utilisé à l’heure actuelle dans les secteurs dit sensibles, c’est-à-dire nécessitant une cohérence et une grande intégrité des données. Jusqu’à la version 5.1 incluse, c’est le seul moteur supportant les contraintes de clés étrangères (intégrité référentielle).
Il n’est pas concevable d’avoir des informations faisant référence à quelque chose d’inexistant. Peut-on imaginer un numéro de sécurité sociale qui ne soit pas associé à une personne ou un code postal associé à aucune ville ? Il y a des domaines d’application où les données doivent être fiables à 100%.
Au-delà de l’intégrité référentielle, InnoDB propose des mécanismes transactionnelles présentant une grande compatibilité aux critères ACID.
X-B. Organisation interne
Avec une base de données composée de tables utilisant le moteur InnoDB, il est important de ne pas utiliser les mêmes méthodes qu’avec une base contenant uniquement des tables MyISAM. Avec les tables utilisant le moteur MyISAM, il est facile de copier, supprimer une base de données : il suffit de copier le répertoire se trouvant dans le répertoire /Data/ portant le même nom que la base de données. De là, il est possible de le déplacer vers un autre serveur, de réaliser une autre base de donnés à partir de celle-ci, d’effectuer des sauvegardes. Par contre, si la base de données comporte des tables utilisant le moteur InnoDB, il faudra faire plus attention. En effet, toutes les données de toutes les tables de toutes les bases sont stockées dans un espace de tables commun. De ce fait, la base devient un peu plus rigide.
28/11/2023Categories: RéseauTags: WindowsComments off
As the connection between your internal network and the rest of the world, public Web servers always deserve an extra measure of protection. Find out one way to lock down these servers.
Serving data to users outside of an internal network, public Web servers are typically the first point of contact for an external attack. In addition, internal networking ports are the most revealing and most often attacked ports on a server. That’s why you need to make sure you’ve disabled the services that are specifically for intranets.
The two biggest culprits that you need to worry about are the Server Message Block (SMB) protocol and NetBIOS over TCP/IP. Both services can reveal a wealth of security information and are reoccurring vectors for hacks and attacks. They’re unnecessary for the operation of a public Web server, and you should take steps to shut down both services on these servers.
Disable NetBIOS
NetBIOS was once a useful protocol developed for nonroutable LANs. In this case, it acts as a session-layer protocol transported over TCP/IP to provide name resolution to a computer and shared folders. NetBIOS uses these ports:
UDP 137: NetBIOS name service
UDP 138: NetBIOS datagram service
TCP 139: NetBIOS session service
Since external users — or hackers — don’t need access to shared internal folders, you should turn off this protocol. To disable NetBIOS over TCP/IP, follow these steps:
Got to Start | Control Panel, and double-click the System applet.
On the Hardware tab, click the Device Manager button.
Select Show Hidden Devices from the View menu.
Expand Non-Plug And Play Drivers.
Right-click NetBios Over Tcpip, and select Disable.
Close all dialog boxes and applets.
This disables the Nbt.sys driver, which stops NetBIOS from listening to or initiating sessions over TCP 139. While SMB normally uses this port for communication, it will now switch to TCP 445 — also known as the Common Internet File System (CIFS) port. That’s why you need to disable SMB next.
Uninstall SMB
SMB uses TCP 139 or TCP 445 — depending on which port is available. There’s one way to disable SMB on a non-domain controller. However, I recommend completely uninstalling this service to prevent some well-meaning individual (or program) from re-enabling the service.
To uninstall SMB, follow these steps:
Go to Start | Control Panel, and double-click the Network Connections applet.
Right-click Local Area Connection (i.e., the Internet-facing connection), and select Properties.
Select Client For Microsoft Networks, and click the Uninstall button.
After the uninstall finishes, select File And Printer Sharing For Microsoft Networks, and click the Uninstall button.
Close all dialog boxes and applets.
Understand the ramifications
You’ve now disabled both SMB and NetBIOS. If an attacker manages to compromise your Web server, he or she won’t be able to use NetBIOS or SMB to further explore and exploit your network.
Of course, security measures are often a balancing act of functionality and security. In this case, disabling these services takes away your ability to remotely manage Web servers through Active Directory’s Computer Management console. However, you can still connect to and manage these servers through the Remote Desktop Client.
Final thoughts
While it’s a common practice to block these ports at security boundaries, nothing beats disabling them on the machines themselves. Remember, as the connection between your internal network and the rest of the world, Web servers always deserve an extra measure of protection.
I have tons of PDFs in multiple sub-folders in /home/user/original that I have compressed using ghostscriptpdfwrite in /home/user/compressed.
ghostscript has done a great job at compressing about 90% of the files however the rest of them ended up bigger than originals.
I would like to cp/home/user/compressed to /home/user/original overwriting files that are only smaller than the ones in destination while the bigger ones are skipped.